CodeIgniter Forums
javascript issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: javascript issue (/showthread.php?tid=14871)



javascript issue - El Forum - 01-18-2009

[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++;
}



javascript issue - El Forum - 01-18-2009

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


javascript issue - El Forum - 01-18-2009

[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?


javascript issue - El Forum - 01-18-2009

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

para[dot]innerHTML += id;