-1

I have code where half textbox have constant value and other half i can type my text. It all works fine with GetElementById but i want change it to getElementByName. Have tried several options to make getElementByName work, like getElementByName ("name")[0].value, getElementByName ("name").item(0).value, but still nothing.

var inputA = new halfEditable_INPUT(document.getElementByName ("name").item(0).value);

Here is code: https://jsfiddle.net/pact1Lc9/

  • It is difficult to offer solutions when the problem statement is simply, "it doesn't work". Please [edit] your question to give a more complete description of what you expected to happen and how that differs from the actual results. See [ask] for hints on what makes a good explanation. – Toby Speight Nov 09 '16 at 13:26

1 Answers1

2

It should be getElementsByName instead of getElementByName.

document.getElementsByName("name")[0].value;
//               --^--
Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188