i see there is this syntax for detecting any button click
<script type="text/javascript">
$(document).ready(function() {
$(":button").click(function(event) {
alert("Thanks for visiting!" + this.value);
});
});
</script>
but what if i want to only detect a particular button on the page?
EDIT: this seems fine for buttons that are setup at the beginning but in my case i am creating them dynamically with jquery. it seems those buttons dont hit this code. any ideas
You will need to bind “click” to the jQuery “live” function/event for that to work. I would also recommend using either a special CSS class or id on the dynamically generated button. Here is the description of the live even from jQuery.com.