php - split & showing value in javascript -


i have 1 variable in javascript named itemid i.e. var itemid=document.getelementbyid('item_code').value;

in item_code there value in format "1025*1" , want display 1025 not whole in javascript div

plz give me idea, same explode() in php want in javascript display in div

you're looking split method.

for example:

var array = value.split('*'); var first = array[0]; 

alternatively,

var first = value.substring(0, value.indexof('*')); 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -