SageFix. LetsFix!  
Current Location : Home > Web Development > JavaScript > a jquery selector question Share/Save/Bookmark    

Main Menu
SageFix - Let's Fix

Board Categories
    Web Site Designing
- Graphics
    Web Development
- .NET
- Classic ASP
- JavaScript
- PHP
    WebSite Management
- Promotion Techniques
- Search Engine Optimization
    Databases
- MySQL

Tutorials

Database Connection Strings

  Contact Us


 1 - 3 of 3 [Total 1 Pages]  
a jquery selector question      Jul 17, 2009, 00:31 1
  
HTML Code:
my HTML is <div class="classroom"><ul><li>student 1<img src="student1.jpg" /></li><li>student 2<img src="student2.jpg" /></li><li>student 3 <img src="student3.jpg" /></li></ul></div><div class="classroom close"><ul><li>student 1<img src="student1.jpg" /></li></ul></div>
my situation is i need to know the number of the classrooms I have, so I used $('.classroom'), then I will get an array of elements with the classroom class. then I want to loop through all the student and select the image,

how can I do that?

 
      Jul 17, 2009, 00:35 2
  
$(document).ready(function()
{
$classrooms = $('.classroom');

// try to select images from each classroom by doing this way, and doesnt work
$.each($classroom, function()
{
$(this).'img'.css('border', '2px solid red');
});
});

 
      Jul 17, 2009, 01:15 3
  
thanks god, I found the answer.
jQuery('img',this);

 
 1 - 3 of 3 [Total 1 Pages]  









Subscribe to our mailing list
email


Current Location : Home > Web Development > JavaScript > a jquery selector question Share/Save/Bookmark    

Development problem? SageFix is completely free -- paid for by advertisers and donations. Click here to Contact Us If you have any query. Enjoy!
Request processed in 9.0E-5 seconds Home - Contact Us - Terms Of Service - Privacy Policy - Copyrights - Top
Advertisements do not imply our endorsement of that product or service.
Current server time now is 09-Sep-2010 09:45:05
Copyright © 2009 Sagefix Inc. All rights reserved.
Powered By SageFix