Solved

each inside class inside a named div

Posted on 2013-01-04
2
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I alter this script restrict file types with a suffix of 4 charaters also? 3 34
multiple selects 23 62
Wordpress Pagination 1 44
AJAX Wordpress Not Reading Variable 2 57
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…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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…

756 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