Not sure why the code below isn’t working… I’ve tried a number of variations:
$('button.mytestbutton').live('click', function() ...
$('button.mytestbutton').bind('click', function() ...
$('button.mytestbutton').click(function() ...
etc., etc. I’ve also tried inserting return false; before the closing });
In firebug, I don’t get anything at all in the console. Absolutely no indication that it’s been clicked at all… Is there something about “button” that prevents me from doing this?
Here’s the current jquery iteration:
$('button.mytestbutton').live('click', function() {
$('#progress').append('Ok, I clicked it.');
return false;
});
Here’s the HTML:
<button class="mytestbutton">Test</button>
<div id="progress"></div>
I also don’t see any errors in Firebug on initial page load, and when I check the <script></script> tags, I see the js there… Not sure where to go from here…
I did it here: http://jsfiddle.net/8y7Aw/ and it worked perfectly fine. Could there be other JavaScript or HTML IDs that are preventing the action from going? It even works when I use
.clickinstead of.live.