# Javascript made changes but not showing in browser

**URL:** <https://forum.freecodecamp.org/t/javascript-made-changes-but-not-showing-in-browser/273177>\
**Category:** General\
**Created:** [April 23, 2019, 10:21am UTC](https://forum.freecodecamp.org/t/javascript-made-changes-but-not-showing-in-browser/273177 "2019-04-23T10:21:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vyskoc](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/vyskoc/32/104656_2.png) [@Vyskoc](https://forum.freecodecamp.org/u/Vyskoc)\
**Post date:** [April 23, 2019, 10:21am UTC](https://forum.freecodecamp.org/t/javascript-made-changes-but-not-showing-in-browser/273177/1 "2019-04-23T10:21:50Z")

</div>

I am using javascript here to insert an input box if the user has clicked yes.

```auto
  let taxRef = document.getElementById("taxRef");
  function checkInput() {
      if(taxRef.firstChild.nextSibling.checked === true){
      let newEl = document.createElement("input");
      newEl.setAttribute("type","text");
      taxRef.firstChild.nextSibling.appendChild(newEl);
      } 
  }
  taxRef.addEventListener("change", checkInput, false);

```

the html code is as follows

```auto
<label for="taxRef"></label>
<div id="taxRef" name="taxRef">
  <p>Do you have a UTR(tax reference) number?</p>
  <input class="well well-sm" type="radio" name="yesOrNo" value="yes"/>Yes<br>
  <input class="well well-sm"type="radio" name="yesOrNo" value="no"/>No
</div>&nbsp&nbsp&nbsp
<span class="error"><?php echo $taxRefErr;?></span><br>

```

when I open the page and click yes, the console shows that a new input element has been inserted.  
 ![WeChat%20Screenshot_20190423111939](https://global.discourse-cdn.com/freecodecamp/original/3X/5/2/5265e15c745c5f3f705db46f93ee9d0f4114c5da.png)  
but the document displayed in browser is not showing any input box at all.  
 ![WeChat%20Screenshot_20190423112106](https://global.discourse-cdn.com/freecodecamp/original/3X/3/3/33883492c4f222f918823822196b2dbb9a6b661e.png)  
Can someone tell me what has gone wrong here please? Thanks

---

<div class="post-metadata">

**Author:** ![Marmiz](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marmiz/32/74845_2.png) [@Marmiz](https://forum.freecodecamp.org/u/Marmiz)\
**Post date:** [April 23, 2019, 10:55am UTC](https://forum.freecodecamp.org/t/javascript-made-changes-but-not-showing-in-browser/273177/2 "2019-04-23T10:55:09Z")

</div>

It may just be that because the input is empty it has no width, so it looks like it’s not on the page.

Just as a quick test, you can try to give it either a `width` or a `value` (anything that makes it take some space actually) and see if it works

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 9:51am UTC](https://forum.freecodecamp.org/t/javascript-made-changes-but-not-showing-in-browser/273177/3 "2021-01-17T09:51:07Z")

</div>


