In front page I have a input with type text. A button is created aside it. When button is clicked, in js I want to use the text in the input. But I get this error:
Cannot read property 'value' of null frontpage:
New Name: <input type="text" name="newName" value= "blahblah" > </input> <button id="submitNewName">OK!</button> Js:
$("#submitNewName").live('click',function(){ alert(document.getElementById('newName').value); });
getElementByName, notgetElementById. But can easily be done by JQuerygetElementsByName, notgetElementByName. This will return an array of elementslive()has been deprecated for years