JavaScript is disabled!

forRef

forRef();

This jQuery plugin adds a forRef() method that finds the corresponding label(s)/form field (input, select or textarea) for the first matched element, based on their for/id reference. Works both ways.

Returns

jQuery object

Examples

<label for="name">Name</label>
<input type="text" id="name">

Here $("label").forRef(); will match the input element with id="name" and $("#name").forRef(); will match the label with for="name".

Downloads

jquery.forref-0.1.5.js (643 bytes)

Versions