Updating Jquery object with newly created elements after AJAX call


My question is pretty much exactly what the title says:

1.) I generate Page “A” which runs a JQuery command that creates an object of all the items with a class of “.pointer”. This is key as there are also other jquery (click) functions that grant them functionality because of their “.pointer” class.

2.) I then allow the user to use an input box which triggers an AJAX request to page “B” and returns the information into the already loaded Page “A”.

3.) When the information from the AJAX request is displayed, I create a link on each row granting each the class “.pointer” – with the hope that it will be able to trigger the same pre-defined $(click) functions that loaded with Page “A”.

HOWEVER.. 1) I’m having a difficult time knowing what the syntax would be to add new elements to an already existing jquery element and 2) where to do it in code and if it needs to be triggered with an action hook or just wrote into the code with wp_enqueue_script.
Oh also sidenote.. why doesn’t WordPress allow a simple usage of to execute jquery commands?

Thank you for any guidance.



>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/updating-jquery-object-with-newly-created-elements-after-ajax-call/">

Updating Jquery object with newly created elements after AJAX call</a>
, gjnave 8 months 0 Answers 48 views 0

Leave an answer