Javascript examples for jQuery Method and Property:text
Call a jquery function on a variable
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.js"></script> <script type="text/javascript"> $(window).load(function(){//w w w .j a v a 2 s .c o m var comp_id = $.trim($("div.component_id").text()).replace(/^'|'$/g, ''); jQuery(comp_id).text('found'); }); </script> </head> <body> <div class="component_id"> '#test1' </div> <div id="test1"></div> </body> </html>