On click CKEditor viewer run jQuery code

0
Hi all!   Which champ can share a jQuery code that runs when clicked on a CKEditor viewer text box? So I've got the below code functioning on Repl.it It shows Woord1 and Woord2 in a span with an on click action logging the word clicked. I want to do the exact same thing in Mendix. <!DOCTYPE html> <html>   <head>   <meta charset="utf-8">   <meta name="viewport" content="width=device-width">   <title>repl.it</title>   <link href="index.css" rel="stylesheet" type="text/css" /> <style> div.mx-name-textArea2 div label span{ font-size: 30px;   } </style> </head>   <body>   <div class="cKEditorViewerForMendix1">     <div>       <label> <span>woord 1</span> <span>woord 2</span>   </label>     </div>     </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>   <script> jQuery(".cKEditorViewerForMendix1 div label span").on("click", function () { //We extract the text from the element clicked - Works for <p> elements, to be tested on <span> var microflowInputString = jQuery(this).text(); //console.log($(this).attr('class')); console.log(microflowInputString)   }); </script>   </body>   </html>   I tried the below code in both the JavaScript snippet as the HTML snippet that is in the same window as the CKEditor viewer:    jQuery(".wgt-CKEditorViewerForMendixNode mx-name-cKEditorViewerForMendix1 div label span").on("click", function () {      var microflowInputString = jQuery(this).text();   //console.log($(this).attr('class'));   console.log(microflowInputString) });   Inspecting the HTML in chrome:   Hope somebody knows how to do this!   Cheers, Paul
asked
0 answers