Illegal character error in jquery - Javascript String Operation

Javascript examples for String Operation:String Character

Description

Illegal character error in jquery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://code.jquery.com/jquery-1.7.1.min.js"></script> 
  <script>
    $(document).ready(function(){
    $('button').click(function(){
    var rname = 1; /*from  w  ww  .  java  2  s .  co  m*/
    console.log($("#presetname-"+rname+" option:selected").text());
    });
    });
    
      </script> 
 </head> 
 <body> 
  <select id="presetname-1"> 
     <option value="1">1</option> 
     <option value="2">2</option> 
     <option value="3">3</option> 
  </select> 
  <button>Get</button>  
 </body>
</html>

Related Tutorials