Hello everyone,
Using:
FF: 3.5
jQuery: latest
Is there a way to make jQuery use code that has been injected into a <div> element.
This code works:
Code:
....all the including of Jquery etc goes here...
$("#test").click(function()
{
alert("Hey this Works!");
});
...ending scripts and going to body etc.....
<div id=results><input type=button id=test></div>
This code will not work:
PHP Code:
//PHP Code called under specific getjson
$html .= "<input type=button id=test>";
return $html;
Code:
....all the including of Jquery etc goes here...
$.getJSON(url, function(data)
{
$("#results").html(data); //this does successfully add input button
});
$("#test").click(function()
{
alert("Why won't this work!");
});
...ending scripts and going to body etc.....
<div id=results></div>
This code successfully adds <input id=test> into <div id=results> but it will not execute because it has been added later. Is there a way to make this work with getJson?
Thanks,
questionable