Hussy Hussy - 8 months ago 22
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

var str =$(this).attr('id');
var ret = str.split(" ");
var str1 = ret[0];
var str2 = ret[1];