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

[eluser]new_igniter[/eluser]
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!

Code:
onclick = "addInputBox(); return false; "

Code:
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;
    countThis++;
}
#2

[eluser]darkhouse[/eluser]
instead of para[removed] += id; try para[removed] += id;
#3

[eluser]new_igniter[/eluser]
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?
#4

[eluser]darkhouse[/eluser]
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