How does the jquery selector take the value of the variable in the html custom property instead of the whole?

the custom html attribute data-val= ""+ num+"" in the div, I created dynamically, where num is a variable, will generate a div with a different variable value after each creation, such as

var str="<div class="waveform-log log-"+num+"" data-val=""+num+"">"+
  "<div class="tag1" data-val=""+num+"">"+num+"</div>"+
   "<div class="tag2"></div>"+
   "<span class="line-add"></span>"+
   "<span class="icon-times"  data-val=""+num+""></span>"+
   "<span class="icon-arrows-h" data-val=""+num+""></span>"+
    "</div>";

<div class="waveform-log log-1" data-val="1">
<div class="waveform-log log-2" data-val="2">
<div class="waveform-log log-3" data-val="3">

now I want to dynamically take the value of each data-val to each add event. The $(".accounform-log") I use is the same, and it is also wrong to use $("[data-val="" + num+ ""]").

Sep.16,2021

time for dynamic generation, try using event delegates.
binds the event to the parent element.

$(parentSelect) .on ('click','.className',function () {

)
alert(1)

})

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb22f3-23b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb22f3-23b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?