Setting the value
is normally used for input/form elements. innerHTML
is normally used for div, span, td and similar elements.
Here is a link showing the use of ID.value:
http://www.javascript-coder.com/javascript-form/javascript-form-value.phtml
More Related Contents:
- How do I check if an element is hidden in jQuery?
- Why does jQuery or a DOM method such as getElementById not find the element?
- How do I set/unset a cookie with jQuery?
- jQuery .live() vs .on() method for adding a click event after loading dynamic html
- Creating a new DOM element from an HTML string using built-in DOM methods or Prototype
- Detect element content changes with jQuery
- How can I select an element by name with jQuery?
- Difference between innerText, innerHTML and value?
- getElementsByTagName() equivalent for textNodes
- Event handlers inside a Javascript loop – need a closure?
- jQuery object and DOM element
- Javascript get XPath of a node
- How to resolve the C:\fakepath?
- Browser-independent way to detect when image has been loaded
- Difference between DOM parentNode and parentElement
- Intercept paste event in Javascript
- How to show a spinner while loading an image via JavaScript
- How do I serialize a DOM to XML text, using JavaScript, in a cross browser way?
- How do you set the document title in React?
- contentDocument for an iframe
- Can I change an HTML element’s type?
- “Cut and Paste” – moving nodes in the DOM with Javascript
- How to reference the caller object (“this”) using attachEvent
- Is it possible to programmatically catch all events on the page in the browser?
- Is there any way to accelerate the mousemove event?
- Inject CSS stylesheet as string using Javascript
- JavaScript: Is it better to use innerHTML or (lots of) createElement calls to add a complex div structure? [duplicate]
- Getting the text from a drop-down box
- Accessing a DOM object defined in an external SVG file
- How do I find the DOM node that is at a given (X,Y) position? (Hit test)