MrKevorkian
asked on
jquery replaceWith problem
hi there,
(i am using jquery-1.3.2.min.jas
i am also using microsoft mvc )
I have one input text box - when i add a integer value to it - that value is ran against a simple calculation then inserted into a label.
This works fine the first time - but when i update the textbox value - the new calculated value is not inserted into the label - the old calculation remains.
However i have established (via an alert) that the change textbox event is firing - and the updated value is being re-calculated - but the insert is not happening.
here is my code:
$("input:text").blur(funct ion() {
//do my calculation - then the alert fires with the updated value
alert('my new calculation' + myCalculatedValue);
$("#myDisplayLabel).replac eWith(myCa lculatedVa lue);
//but the value on the screen does not change from the first time the code is run
});
can anyone help?
(i am using jquery-1.3.2.min.jas
i am also using microsoft mvc )
I have one input text box - when i add a integer value to it - that value is ran against a simple calculation then inserted into a label.
This works fine the first time - but when i update the textbox value - the new calculated value is not inserted into the label - the old calculation remains.
However i have established (via an alert) that the change textbox event is firing - and the updated value is being re-calculated - but the insert is not happening.
here is my code:
$("input:text").blur(funct
//do my calculation - then the alert fires with the updated value
alert('my new calculation' + myCalculatedValue);
$("#myDisplayLabel).replac
//but the value on the screen does not change from the first time the code is run
});
can anyone help?
ASKER
hi,
now nothing gets set! not even the first time?
now nothing gets set! not even the first time?
ASKER
figured it out - its .text(myCalculatedValue)
my bad - I did not pay attention to the label ..... not input text box. :(
ASKER
do you mind if i ask for this to be closed
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i answered my own question
$("#myDisplayLabel).val(my