Solved

each inside class inside a named div

Posted on 2013-01-04
2
145 Views
Last Modified: 2013-01-05
If wanted to access each 'clsTransactionDate'

in the following code:-
<div id="Transactions">
	<div class="TransRow">
		<div class="clsTransactionDate">Date</div>
		<div class="clsTransactionTrans">Transactions</div>
		<div class="clsTransactionCounts"></div>
		<div class="clsTransactionAmount">Amount</div>
		<div class="clsTransactionStatus">Status</div>
	</div>
</div>

Open in new window


I thought the following code would work:-
               $("#Transactions .clsTransactionDate").each( function() { alert($(this).text); });

Open in new window


But it doesn't seem to be able to see anything, what am I doing wrong?
0
Comment
Question by:tonelm54
2 Comments
 

Author Comment

by:tonelm54
Comment Utility
The reason I want it to only pull from inside the div named is there are other divs on the page with the class name clsTransactionDate, but I only want the each function to return those inside the named div Transactions.

I hope that explains things a bit better, and you don't think Im going mad :-)
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
add parentheses after text : text()
test page : http://jsfiddle.net/jjS4d/1/
               $("#Transactions .clsTransactionDate").each( function() { alert($(this).text[b]()[/b]); });

Open in new window

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

by Julian Matz As of jQuery (http://jquery.com/) 1.4 the .live() method (http://api.jquery.com/live/) supports custom events as well as some standard JavaScript events that it previously didn't support. Among these is the submit event. Unlike …
What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
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…

762 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

7 Experts available now in Live!

Get 1:1 Help Now