Why innerText,innerHTML property doesnt work on input tags in javascript?

So i stumbled upon following code

<!DOCTYPE html>

Name: <input type="text" id="myText" value="Mickey">

<p>Click the button to change the value of the text field.</p>

<button onclick="myFunction()">Try it</button>

function myFunction() {
  document.getElementById("myText").value = "Johnny Bravo";


And not having used .value before in javascripte i thought to substitute it by innerText property but it just simply doesnt work !

I am having an idea that maybe as <input/> is a self closing tag that’s why innerText isnt able to insert in between it ? As such to insert in between an element there atleast should be 2 tags

SO can anyone consolidate this ? Or if not then why .innerText isnt working here instead of .value

42 thoughts on “Why innerText,innerHTML property doesnt work on input tags in javascript?”

  1. Pingback: keto diet pyramid
  2. Greetings from Ohio! I’m bored to death at work so I decided to
    browse your website on my iphone during lunch break.
    I enjoy the knowledge you provide here and can’t wait to take a look when I get home.
    I’m surprised at how quick your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyhow, amazing site!

  3. I do not even know how I ended up here, but I thought this post
    was good. I don’t know who you are but certainly you’re going to a famous blogger
    if you aren’t already 😉 Cheers!

  4. Howdy! This is kind of off topic but I need some guidance from
    an established blog. Is it difficult to set up your own blog?
    I’m not very techincal but I can figure things out pretty quick.
    I’m thinking about setting up my own but I’m not
    sure where to begin. Do you have any points or suggestions?


  5. What i do not understood is if truth be told how you are not actually a lot
    more neatly-favored than you may be now. You’re very intelligent.
    You recognize therefore significantly when it comes to this matter,
    produced me personally believe it from so many varied angles.
    Its like men and women aren’t interested until it is something to accomplish
    with Lady gaga! Your individual stuffs outstanding. At
    all times take care of it up! cheap flights http://1704milesapart.tumblr.com/ cheap flights

  6. Fantastic goods from you, man. I’ve understand your stuff previous to and you’re just
    extremely great. I actually like what you’ve acquired here,
    certainly like what you are saying and the way in which you say it.
    You make it enjoyable and you still care for to keep it wise.
    I can’t wait to read far more from you. This is really a tremendous website.
    scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery


Leave a Comment