Javascript examples for DOM:Document getElementsByName
use brackets in element name and call document.getElementsByName
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function enableInput() {// w w w . j a v a2s . c om console.log("aa"); document.getElementsByName('user[135][name]')[0].disabled = false; } </script> </head> <body> <form name="myForm"> <input size="15" name="user[135][name]" value="" disabled> </form> <input type="button" onclick="enableInput()" value="Enable"> </body> </html>