javascript - Can't select button with jQuery -
i'm trying select
<input type="button" class="set_image_btn" value="set image" />
with
$('.set_image_btn').live("click", function(){ alert('clicked!'); });
but reason won't work. html made javascript in html file , suspect .js file unable this, i'm not sure how select it.
make sure calling code after created html javascript, you'd have this:
$('<input type="button" ...').appendto("body"); //i asume create it. alert($('.set_image_btn').size()); //this test alert. should alert '1' $('.set_image_btn').live("click", function(){ alert('clicked!'); });
if test alert alerts '0' means didn't create element or didn't append page.
hope helps. cheers
Comments
Post a Comment