I have this form http://jsfiddle.net/thiswolf/XDsSt/ with four identical inputs and buttons.The problem is,each section is updates its own unique data in the database so when updating,its important the submit button i click updates the database with the input from that section only.
My function is
$(document).ready(function() {
$(".xx").live('click', function(){
alert('clicked');
});
});
How do i make sure the button click is unique to that section?.
Get the corresponding section that button belongs to . Then access the elements inside that. You may use the jQuery
closest()/parent()(if only one layer of hierarchy of controls) function for that.Sample : http://jsfiddle.net/XDsSt/8/
I recommend you to switch to jQuery
oninstead ofliveas it is deprecated.