‹‹ homejQuery Extra Selectors Plugin

More Selectors

This is somewhat of a fork of the Extra Selectors plugin by George Adamson for those who wish to use the plugin with jQuery 1.3.x or greater, since that original looks like "abandonware" at this point.

This plugin adds several new selectors and DOM Traversal methods to jQuery.

Form Selectors

Selector Usage example Description
:hover $("DIV:hover") Find the element under the mouse.
:focus $("INPUT:focus") Find the element that has the focus. This will typically be a <INPUT>, <TEXTAREA>, <SELECT>, <BUTTON> or <A> element.
:blur $("INPUT:blur") Find the element that has just lost the focus. This will typically be a <INPUT>, <TEXTAREA>, <SELECT>, <BUTTON> or <A> element.
:modified $("*:modified") Find <INPUT>, <TEXTAREA> or <SELECT> elements whose value or checked property has changed since the page loaded. (For <INPUT> elements this does not apply to checkbox or radio)
:Contains $("DIV:Contains('some text')") Same as :contains() but is case insensitive.
:option $("*:option") Find multiple/choice form items: RADIO, CHECKBOX and OPTION elements.
:option-def $("*:option-def") Find <OPTION>, <input type="radio"> and <input type="checkbox"> elements that were selected/checked originally, before changes were made.
:option-sel $("*:option-sel") Find <OPTION>, <input type="radio"> and <input type="checkbox"> elements that are currently selected/checked.
:option-mod $("*:option-mod") Find <OPTION>, <input type="radio"> and <input type="checkbox"> elements un/selected or un/checked since page loaded. Same as :modified but is for <OPTION>, <input type="radio"> and <input type="checkbox"> elements only.
:text $("*:text") Find TEXT and TEXTAREA elements. Equivalent to $("INPUT[type='text'], TEXTAREA")
:multiple $("*:multiple") Find <SELECT multiple> elements. Equivalent to $("SELECT[multiple]"). Only included for continuity with the INPUT selectors.
:selected $("*:selected") Find <SELECT> elements with 1 or more selections, and all <OPTION> elements that are selected.

Methods

.wrapText()

Plugin to wrap html around non-empty text node(s) within an element: (ignores text in child elements)

  $("li").wrapText("<label/>")

  // Before:
  <li><input/>some text</li>

  // After:
  <li><input/><label>some text</label></li>