Jump to content

Javascript clear text box problem


besly98

Recommended Posts

Hi Al,

 

I have the following code below which will insert a value into a text box on click, but i want to clear the current vale of the input field as it inserts the new value.

can anyone help?

 

function populate (inElem) {
  var el = document.getElementById("country")  // display in text box
  if (el) {  // in case 'foo' does not exist
    el.value += " " + inElem.innerHTML
  }
  if (el2) {
    el2.value += inElem.innerHTML+"\n"
  }
}

 

Thanks in advance

 

Jon

 

Link to comment
https://forums.phpfreaks.com/topic/213047-javascript-clear-text-box-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.