Learn, Share, Build

169
September 21, 2017, at 6:26 PM

I'm working on a web gallery and i get the albums through ajax request and use PHP for the back end and after that i retrieve the albums and display it in a particular element in the html ,I use smarty to display it ,but i cant seem to register the response elements in DOM .I have used .on('click',function() but still it isn't working.

Answer 1

As you said you want to register jquery click event on dynamically created elements, you have to use jquery delegation technique to make it working. You have to change your jquery funciton like this:

$(document).on('click','.class',function(){
    // Here you can do further jquery code.
});
READ ALSO
Learn, Share, Build

Learn, Share, Build

I have a pretty complex form in WordPress using Advanced Custom FieldsUnfortunately, ACF doesn't allow dynamic field population as such so I'm using jQuery to do so

179
Learn, Share, Build

Learn, Share, Build

How can I select a radio button option if nothing is selected (no default value)I try this but I only got the first option selected and in this case I need the second option of my radios

165
Learn, Share, Build

Learn, Share, Build

I have created a facebook share button for a html div which contains an information like title, image and informationOn click of facebook share button I want to send all the information (title, image , description) to facebook so that I can share it on facebook

161
Learn, Share, Build

Learn, Share, Build

Here's pop-under code that I found on googleI need to get a form in pop-under

142