0

There is an html code in which there are many divs with different classes. There are actions inside the divs, and you need to get a list of all the mouse clicks you need. (where onclick = my.action, ignoring the rest).

    <div class="content clear_fix">
       <div class="content _date">
         <a class="wd_lnk" (...) </a>
       </div>

      <div class="reply_content">
         <div class="content">
            <div class="content_actions">
               <div id="action-*(current string ID)*" data-title="Action" onclick="unnecessary.action(this, *(current string ID)*, (some unique ID));">
               </div>
           </div>
        </div>
    
       <div class="reply_content">
         <div class="content">
            <div class="content_actions">
               <div id="action-*(current string ID)*" data-title="Action" onclick="my.action(this, *(current string ID)*, (some unique ID));">
               </div>
           </div>
        </div>

       <div class="reply_content">
         <div class="content">
            <div class="content_actions">
               <div id="action-*(current string ID)*" data-title="Action" onclick="unnecessary.action2(this, *(current string ID)*, (some unique ID));">
               </div>
           </div>
        </div>
    
       <div class="reply_content">
         <div class="content">
            <div class="content_actions">
               <div id="action-*(current string ID)*" data-title="Action" onclick="my.action2(this, *(current string ID)*, (some unique ID));">
               </div>
           </div>
        </div>

      </div>
    </div>

How can I get a list of all onmouseclick actions in one place?

Smth like that, for example:

my.action(this, *(current string ID)*, (some unique ID));
my.action2(this, *(current string ID)*, (some unique ID));
A.Max
  • 47
  • 6
  • I've no clue what you're asking. Determined by your HTML, you probably need [event delegation](https://stackoverflow.com/q/1687296/1169519). – Teemu May 10 '22 at 05:25
  • from the all html code take only onmouseclick action that match the condition "my-action(...)". Like in example at the end of post – A.Max May 10 '22 at 05:39
  • A list of what exactly? Inline handlers as references? Inline handler content as a string? Something else? – Teemu May 10 '22 at 06:20
  • list of what is in onmouseclick quotation marks – A.Max May 10 '22 at 13:35
  • I still have no clue how would such a list be useful, but take a look at [this jsFiddle](https://jsfiddle.net/s3d084g5/), it creates a list of string values of all onclick attributes which are calling any function which of name starts with `my.action`. – Teemu May 10 '22 at 14:13

0 Answers0