I have a php function:
function myfunc() {
//then I have a div...
echo '<div class="overlay">';
echo "<button onclick=\"$('.overlay').hide();\">Close</button>";
echo '</div>';
}
My problem is that when I click on the close button the div is not hiding.
What I’m I doing wrong here?
Avoid to hardcode javascript handlers and inline events inside the output of php code: do instead
and previously insert in your page this code that detects a click on your button using event delegation