Inside JavaScript, At runtime I am getting HTML code for checkbox inside a string as follows:
var chk="<input type='checkbox' id='checkbox1' name='chk1' />";
I want to get the ID of the checkbox.
My Question is:
Does jquery support any api to to retrive value of id?
Or
Do I have to follow the JavaScript api to achieve the same?
Note: Currently I am using following JavaScript code:
var i=chk.indexOf("id");
var s=chk.substring((i+4));
var j=s.indexOf("'");
s=s.substring(0,j);
Finally s contains id of checkbox.