I am using jquery and the action Im trying to get is when a person clicks a button I have it slide down a hidden div underneath it and display the hidden div. Inside that div there is a form field with a submit button. How would I go about listening for the event of someone clicking the submit button inside that div? I cant seem to get it to work:
UPDATE: This seem to work, let me know if this is the proper way:
$('.button.green.table').live('click',function() {
var dataString = $(this).attr('title');
$("#formdiv" + dataString).slideToggle("fast", function() {
//Added, this works
$(this).find('.button').click(function() {
alert($('input[name$="notes"]').val());
return false;
});
return false;
});
});
EDIT SOME HTML:
<button class="button green table" title="1">Add Notes</button>
<div id="formdiv1">Notes<br /><input type="text" name="notes" value="12" />
<button class="button" id="buttontest">GO</button></div>
I’d begin by taking the buttons click event out of the forms slideToggle event as it doesn’t belong there.
also, are you sure the id’s are correct once the page is rendered? I always use the class selector and never the Id because in asp.net the id’s can change. you don’t specify what you are using
edit
or