Append string as the element id - Javascript DOM

Javascript examples for DOM:Document getElementById

Description

Append string as the element id

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {//from  w w w.  j a  v  a2s  .  c o  m

function load_rights(product) {
   document.getElementById(product+'_radio_selection').checked = true;
}
load_rights('bar');

    });

      </script> 
   </head> 
   <body> 
      <input type="radio" id="foo_radio_selection" value="">
      Foo
      <br> 
      <input type="radio" id="bar_radio_selection" value="">
      Bar
      <br>  
   </body>
</html>

Related Tutorials