So, I'm using jQuery with PHP, and, I am echoing out a button:
echo '<input type="button" id="button" value="Info" style="float: right;"/>';
Pretty simple, I tried using "\" for the quotations, but, that didn't make any difference (for those who will point it out.
Anyway, the jQuery portion is pretty simple:
$("#button").click(function() {
alert("Clicked");
});
Within the $(document).ready(function(){});
The echo is passed through an ajax call. If that makes any difference, and.
I do not get the alert. So if anyone can pinpoint the solution that would be great.
liveinstead ofclicklike @ken has done below in his answer. The element doesn't exist when the event is bound, so it doesn't work.