I have A function in jquery which goes to a php file, which querys a database returns the results in a table with a button in each row,
how do i access the buttons in the page that the jquery is on. here is some code
//function to get table form php file with button on each row
function show(str)
{
$.post('INCLUDES/gettable.php',{club: str},
function(output)
{
$('#box').html(output).show();
});
}
//when button from table is clicked do something
$("button").click(function()
{
alert("hello");
}
Any help is appreciated
Use
live()or betteron()(comes with latest version of jQuery) for dynamically generated html/data:Or