I have two php file file1.php and file2.php, file1.php send something with ajax to file2.php,
return data from file2.php, like
echo "<a class='test' id='test'>click me</a>";
In file1.php, I use innerHTML to display it
document.getElementById("test2").innerHTML=data;
I want click the a tag link and alert("something")
$("#test").clicl(function(){
alert("hello");
});
The problem is I cant select the a tag link with Id attribute or Class attribute, how to do it? Thank you very much.