Solved

each inside class inside a named div

Posted on 2013-01-04
2
148 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
ID: 38745722
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
ID: 38745751
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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…

920 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

17 Experts available now in Live!

Get 1:1 Help Now