Solved

jQuery - update value in class within specific div.

Posted on 2012-04-02
3
309 Views
Last Modified: 2012-04-02
Hi, if id is equal to 1164 and newQty is 14 how should I code the line below in order to update
<div class="left_box_qty">2</div>  
to
<div class="left_box_qty">14</div>

Thanks in advance for your comments.

$("#remove_blue_box"+id+".left_box_qty").html(newQty);      


<div id="remove_blue_box1164" >
                 <div class="blue_box_break_line"></div>
                    <div class="left_box_qty">2</div>  
             <div class="left_box_price">$ 39.00</div>
</div>
         
<div id="remove_blue_box1054" >
                 <div class="blue_box_break_line"></div>
                 <div class="left_box_qty">1</div>  
             <div class="left_box_price">$ 29.00</div>
</div>
0
Comment
Question by:sabecs
3 Comments
 
LVL 4

Accepted Solution

by:
elliottbenzle earned 350 total points
ID: 37795990
$("#remove_blue_box1164 .left_box_qty").html("newQty");

In your code, try putting a space before the .left_box_qty

$("#remove_blue_box"+id+" .left_box_qty").html(newQty);
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 150 total points
ID: 37796000
this much should be enough
$("#remove_blue_box"+id + " .left_box_qty" ).html(newQty);
0
 

Author Closing Comment

by:sabecs
ID: 37796076
Thanks..
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
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)

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now