Solved

jquery replaceWith problem

Posted on 2010-11-10
7
361 Views
Last Modified: 2012-05-10
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(function() {

//do my calculation - then the alert fires with the updated value
alert('my new calculation' + myCalculatedValue);

$("#myDisplayLabel).replaceWith(myCalculatedValue);
//but the value on the screen does not change from the first time the code is run
});

can anyone help?





0
Comment
Question by:MrKevorkian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 7

Expert Comment

by:dxdinh
ID: 34104934
try this

$("#myDisplayLabel).val(myCalculatedValue);
0
 
LVL 1

Author Comment

by:MrKevorkian
ID: 34105063
hi,

now nothing gets set!  not even the first time?
0
 
LVL 1

Author Comment

by:MrKevorkian
ID: 34105152
figured it out - its .text(myCalculatedValue)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:dxdinh
ID: 34105329
my bad - I did not pay attention to the label ..... not input text box. :(
0
 
LVL 1

Author Comment

by:MrKevorkian
ID: 34110453
do you mind if i  ask for this to be closed
0
 
LVL 1

Accepted Solution

by:
MrKevorkian earned 0 total points
ID: 34240042
figured it out - its .text(myCalculatedValue)
0
 
LVL 1

Author Closing Comment

by:MrKevorkian
ID: 34276872
i answered my own question
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question