Hussy Hussy - 1 year ago 108
Javascript Question

jQuery string split the string after the space using split() method

my code

var str =$(this).attr('id');

this will give me value == myid 5

var str1 = myid
var str2 = 5

i want something like this ..

how to achieve this using split method

Answer Source
var str =$(this).attr('id');
var ret = str.split(" ");
var str1 = ret[0];
var str2 = ret[1];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download