In a PHP page i have several rows of one table like this
echo '<tr><td><a href="#" onclick="myFunction('.$id.')">Click</a></td></tr>';
The $id is dynamically generated from a database
So I want to define the function in jQuery but to pass the parameter to the jQuery function.
For each button I click there will be another parameter passed
Why not use the ID as an identifier for the link like this:
In jQuery you can bind to the onclick event like this:
// Execute on load $(document).ready(function(){ // Bind to click $('a.myjquerylink').click(function(){ // Get the id var id = $(this).attr('id'); // Do something with the id. doSomething(id); }); });