Solved

jQuery - update value in class within specific div.

Posted on 2012-04-02
3
315 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
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…

860 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