Welcome Guest, Not a member yet? Register   Sign In
javascript issue

Hello, I am using the following javascript function to write another text input if the user clicks 'add text box'. using the onclick statement below. It writes the new input field find, but the odd problem I am running into is that it will clear any text added in the new input fields if another input field is added. So let me provide a scenario:

the user clicks "add new field" and enters "foo something" as text into that field. They then decide to add another field and clicks "add new field". It will clear the "foo something" entered into the first created input field. Thanks!

onclick = "addInputBox(); return false; "

var countThis =1;
function addInputBox(currentCount)
    var id = '<input type="text" name="newTag['+countThis+']" id="tt'+countThis+'" value="" size="50"/>';
    var para = document.getElementById("tagsInput");
    para[removed] += id;

instead of para[removed] += id; try para[removed] += id;

hmm looks like both of our posts had content removed and your post options look identical. Sorry to bother but can you re-post what you intended to write?

oh yeah, weird. Sorry, I didn't even notice. Maybe what we wrote is the same thing.

para[dot]innerHTML += id;

Theme © iAndrew 2016 - Forum software by © MyBB