Click here to Skip to main content
15,887,346 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: ng-grid wrap-text rows with verical scrolling Pin
Stephen Holdorf3-Mar-16 2:59
Stephen Holdorf3-Mar-16 2:59 
QuestionRotation functionality is not working in viewer Pin
Member 1235806428-Feb-16 19:10
Member 1235806428-Feb-16 19:10 
Questionif click on one hyperlink navigate another Page(It contains image map-Healight Perticualr location) Pin
Member 1131823316-Feb-16 21:00
Member 1131823316-Feb-16 21:00 
AnswerRe: if click on one hyperlink navigate another Page(It contains image map-Healight Perticualr location) Pin
aarif moh shaikh19-Feb-16 20:55
professionalaarif moh shaikh19-Feb-16 20:55 
QuestionHelp Needed Pin
Member 1231273311-Feb-16 10:43
Member 1231273311-Feb-16 10:43 
QuestionRe: Help Needed Pin
ZurdoDev23-Feb-16 9:02
professionalZurdoDev23-Feb-16 9:02 
QuestionJquery, changing span values with HTML5 data attr inside a div Pin
jkirkerx11-Feb-16 9:50
professionaljkirkerx11-Feb-16 9:50 
AnswerRe: Jquery, changing span values with HTML5 data attr inside a div Pin
Richard Deeming11-Feb-16 10:17
mveRichard Deeming11-Feb-16 10:17 
The each function iterates through all of the elements matched by the selector - ie: the div elements with the specified data attribute. It doesn't iterate over the descendants of the matched items, which is what you're trying to do.

You don't actually need to iterate over the descendants. You can just find the relevant span elements and update them directly:
JavaScript
var dRecord = $('div.cartRecord[data-cartID="' + _cartID + '"]');
dRecord.find("span[data-qty]").html(data.Qty).data("qty", data.Qty);
dRecord.find("span[data-total]").html(data.Total).data("total", data.Total);

Also worth noting that the return from the $ function will never be null. If there are no matching elements, you'll still get a jQuery object back, with a length of zero.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Jquery, changing span values with HTML5 data attr inside a div Pin
jkirkerx11-Feb-16 10:54
professionaljkirkerx11-Feb-16 10:54 
GeneralRe: Jquery, changing span values with HTML5 data attr inside a div Pin
Nathan Minier12-Feb-16 1:55
professionalNathan Minier12-Feb-16 1:55 
GeneralRe: Jquery, changing span values with HTML5 data attr inside a div Pin
jkirkerx12-Feb-16 6:30
professionaljkirkerx12-Feb-16 6:30 
GeneralRe: Jquery, changing span values with HTML5 data attr inside a div Pin
Nathan Minier12-Feb-16 7:03
professionalNathan Minier12-Feb-16 7:03 
GeneralRe: Jquery, changing span values with HTML5 data attr inside a div Pin
jkirkerx12-Feb-16 8:17
professionaljkirkerx12-Feb-16 8:17 
GeneralRe: Jquery, changing span values with HTML5 data attr inside a div Pin
Nathan Minier12-Feb-16 8:34
professionalNathan Minier12-Feb-16 8:34 
SuggestionRe: Jquery, changing span values with HTML5 data attr inside a div Pin
Richard Deeming12-Feb-16 8:41
mveRichard Deeming12-Feb-16 8:41 
GeneralRe: Jquery, changing span values with HTML5 data attr inside a div Pin
Nathan Minier12-Feb-16 8:57
professionalNathan Minier12-Feb-16 8:57 
GeneralRe: Jquery, changing span values with HTML5 data attr inside a div Pin
jkirkerx12-Feb-16 9:13
professionaljkirkerx12-Feb-16 9:13 
QuestionJTable Add New Record button Pin
Member 1231770910-Feb-16 0:25
Member 1231770910-Feb-16 0:25 
Questionhow to open the JTable Add new Record form in button click in another form Pin
Member 123177099-Feb-16 23:02
Member 123177099-Feb-16 23:02 
AnswerMy Vote of 1 Pin
Keith Barrow12-Feb-16 4:57
professionalKeith Barrow12-Feb-16 4:57 
Questionworking with showCreateForm() in jtable Pin
Member 123177099-Feb-16 19:23
Member 123177099-Feb-16 19:23 
AnswerRe: working with showCreateForm() in jtable Pin
F-ES Sitecore9-Feb-16 22:42
professionalF-ES Sitecore9-Feb-16 22:42 
GeneralRe: working with showCreateForm() in jtable Pin
Member 123177099-Feb-16 22:55
Member 123177099-Feb-16 22:55 
GeneralRe: working with showCreateForm() in jtable Pin
F-ES Sitecore9-Feb-16 22:58
professionalF-ES Sitecore9-Feb-16 22:58 
QuestionWhen IFrame load event is called ? Pin
Tridip Bhattacharjee4-Feb-16 1:45
professionalTridip Bhattacharjee4-Feb-16 1:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.