i want to make a single submission with dynamic jquery script but it doesn’t worked
what wrong with my code?
$(document).ready(function(){
$("#foo").each( function( i )
{
$("button#foo").eq(i).click(function()
{
var a = this.val();
alert(a);
});
});
});
<div id="tabs-1"><input type="type" value="one"><button id="foo"></button></div>
<div id="tabs-2"><input type="type" value="two"><button id="foo"></button></div>
<div id="tabs-3"><input type="type" value="tree"><button id="foo"></button></div>
thanks mapet
Try
value is a property and not a method
In jQuery you can use
Your whole code should be something like this
Edit
Give all the button a class name and use class selector to assign click event. Change your button ids. ID should be unique in a document.
Working Demo
Second Edit