Jquery problem alert does not come out

I"d like to ask you why alert doesn"t come out when you write it like this. Click on it and it doesn"t respond

.
Mar.13,2021

Click the event into the ajax and put it after $(tbody) .html (str)


for the generated element, use on. Something like this:
/ / replace p with the element that the table puts in.
$("p"). On ("click", function () {
alert (1);
});
would be fine.


this is a dynamically added event. Either add $(tbody) .html (str) or use event delegate


because the binding event is executed first, but the ajax callback has not been executed at this time, and the target dom is not yet produced before the ajax callback function is executed. Just modify it as in the first comment

< hr class= "callback" >.

you bind the event first and then add elements to the page

$("tbody").on("click",".handle",function(){
    alert(1)
})
Menu