how to grab values from jQuery .html function

wared

New Member
how can I grab values from jQuery .html() function for the following piece of code?\[code\]$('#div_id').html('<input name="textbox1" id="txt1" type="text" size="40" maxlength="350">');\[/code\]The code works like this, on clicking a button a text box is generated. I have another button(with id="btn2"), clicking on this button I want to grab the values from this textbox(with the id="txt1") and to assign it into a variable.The action code for the btn2 which I have made: \[code\]$('#btn2').bind("click", function(){ variable = $('#txt1').val(); alert(variable);}); \[/code\]I am not able to retrieve the value of the textbox since it is generated using .html()Kindly help me to solve this problem!Thanks,~Ganesh
 
Back
Top