aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes testing jQuery selectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "testing jQuery selectors" Watch "testing jQuery selectors" New topic

testing jQuery selectors

J. Kevin Robbins
Ranch Hand

Joined: Dec 16, 2010
Posts: 634

This is probably one of those things that everyone except me already knows about, but I'm sharing it anyway because it's worth a bookmark.

I was struggling with a jQuery selector and went looking for a testing framework when I found this page. I'm not usually very impressed with the stuff from w3schools, but this is very handy.

"There is no reason for any individual to have a computer in his home" ~ Ken Olson, Co-founder of DEC, 1977
Michael Matola
Ranch Hand

Joined: Mar 25, 2001
Posts: 1740
Why bother shuttling your HTML out to some external page?

For most of my purposes I just open the JavaScript console in the browser and do something like $('p').length; or $('p').css('border', 'solid 2px red'); Or depending on which browser you're using just $('p') will give you a handle on the set of elements, which you can then drill down through.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60079

I also set one of these up for the chapter 2 example code of jQuery in Action (2nd ed) at

But I also agree with Mike: sometimes it's easier just to do it locally on your own HTML using the JavaScript console. If this is not something you are familiar with, you should not write another single line of JavaScript until you learn to use it. It's the #1 best tool you need.

P.S. I avoid w3schools just on principle.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Don't get me started about those stupid light bulbs.
subject: testing jQuery selectors
Similar Threads
Clean up script
getting stareted with jquery
Need help in Architecture design
Question on jQuery ajax functionality & troubleshooting called bean in JSF page
Send response to AJAX from jsp