Javascript examples for jQuery:Tag Traversing
Use a variable in a jQuery selector
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> <script type="text/javascript"> $(document).ready(function() { var myID="123"; $("#das_"+myID).html("Changed!"); });//w w w. j a v a2s . com </script> </head> <body> <div id="das_123"> content </div> </body> </html>