0
<input type="text" name="borderColor" id="myInput">

var myInput = document.getElementById("myInput");

document.getElementById('selector').style.myInput.name= "(style value)";
// want to use the .name attr after style here

Checked something about eval(), but seems not the right thing. Please help. Thanks a lot!

Kenny
  • 153
  • 1
  • 1
  • 9
  • 2
    `document.getElementById('selector').style[myInput.name] = "(style value)"` – t.niese Nov 24 '17 at 13:07
  • To access attribute, use [`Element#attributes`](https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes). To access the value, use `value` attribute of input element. I don't see why you would need to actually execute any code. – rishat Nov 24 '17 at 13:07
  • Thank you very very much t.niese :) – Kenny Nov 24 '17 at 13:08

0 Answers0