first, i have multiple dynamic buttons which generate by php. example:
<button id='btn' type='submit' name='btn' value='recordnumber5' title='deletefromtableA'>delete</button>
<button id='btn' type='submit' name='btn' value='recordnumber50' title='deletefromtableA'>delete</button>
<button id='btn' type='submit' name='btn' value='recordnumber15' title='deletefromtableA'>delete</button>
<button id='btn' type='submit' name='btn' value='recordnumber35' title='deletefromtableA'>delete</button>
now i need to pass/get value to jquery when i calling jquery
$("#btn").click(function(){
var tit=("$btn").attr("title");
var val=("$btn").attr("value");
alert(tit +":"+ val);
});
my problem is, it only function for the 1st button, others did not function. i know my code is have problem but how should i write, so that i can have multiple dynamic button but calling/using 1 jquery script and it can receive data from that button.
by the way, i did search on google and here but i could not find and refer, may be i dont know what is the right keyword to search.
Ps: if possible i wish to put the jquery into function and save to a js.file anyway, thanks for helping.