Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

each inside class inside a named div

Posted on 2013-01-04
2
Medium Priority
?
160 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 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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.
This article discusses how to create an extensible mechanism for linked drop downs.
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)

972 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