javascript - How to access child elements? -


i using jquery plugin. after rendering in browser, html layout following lines of code.

<html> <body>     <div class="mce-container-body">         ...         <input type="text" id="textedit01">         ...     </div>     <iframe>         <html>         ...         <input id="submitbuttonid" type="submit" />          <script type="text/javascript">              jquery(document).ready(function ($) {                 $('#submitbuttonid"').click(function () {                     var url = "http://localhost:61222/14communityimages/hands.png";                     var $container = $(this).parent();                     $container.toggle();                     $(".mce-container-body input", $container).val(url);                     tinymcepopup.close();                 });             });          </script>          ...         </html>     </iframe>  </body> </html> 

now issue code

var $container = $(this).parent(); $container.toggle(); $(".mce-container-body input", $container).val(url); 

is accessing top level html elements. have append url value in input tag inside .mce-container-body... please !!!

try this

window.parent.$(".mce-container-body input").val(url); 

this should work if have source same domain in iframe.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -