joshclarkson.net Blog Archive jQuery, Selecting the Previous Element With Filtering

Recently I was looking for a solution to this problem.The idea being that you would click the image with the “delete” class and submit an ajax call to delete the tag for that file in a Folksonomy system. I had the hardest time trying to figure out how to select the tagcontrol link, I needed to acquire it’s ID for one of the data variables in the ajax call. The answer came from prevAll(). With only the “this” reference from the clicked image, you can find and select the most previous “a” element that has the “.tagcontrol” class.

1 UPs vs 0 DOWNs

Tags: jquery dom

Submitted by: JohnGalt Submitted on: May 5, 2009

Source:  http://www.joshclarkson.net/blog/jquery-selecting-the-previous-element-with-filtering/#comment-2344

Comments:


This Tut has no comments. Be the first to add your two cents!

Login to post comments.

Popular Tut Tags

TUTlist on twitter

For all the newest TUTs, follow @tutlist

King Tuts

JohnGalt (105 Tuts)
JDStraughan (96 Tuts)
linkbuild (49 Tuts)
TJHooker (47 Tuts)
girish (43 Tuts)

TUTmark

Drag TUTmark to your bookmarks
to begin using our bookmarklet.

Don't know how to use a bookmarklet?
Check out this tutorial.

TUTlist News Feeds

Home Page (RSS and ATOM)
New TUTS (RSS and ATOM)
Subscribe by Email

Advertise HERE!

To learn how to get your ad here.
CONTACT US TODAY!