javascript - Input box will not "forget" the first value it gets Firefox 20.0 -


the problem have input box not forgetting first input gets. feeds when content should have been on written new input. code using works fine ie8 problem seen firefox 20.0.

i working entirely in javascript. there no html beyond body.

i use set input box:

addelementwithidbutnonode("input","manimp","div42"); // add input box addelementwithnodeandid("button","set","div42","setbutton"); //add "set" button document.getelementbyid("setbutton").onclick=showit; 

"manimp" id , below captures entered first time around "themainvar".

function showit()   {   themainvar=manimp.value;   themainvar=parsefloat(themainvar);   alert(themainvar);   } 

the problem if run again in firefox can enter value alert comes entered first time around.

you can manually sent "manimp.value" else in javascript , change stays stuck @ changed value.

i need "reset manimp can accept new value input box function"

i have had around , found lots of "reset()" , "clear()" funcitons nothing works me.

the same thing happens if swap input box drop down.

i'm new javascript if fix seem obvious you, maybe is!

try getting 'manimp' element inside function, value referenced when function declared. so, inside function use

themainvar = document.getelementbyid('manimp').value;


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -