Skip to content

mu-lib/mu-jquery-if

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery expression for filtering elements.

Installation

npm install mu-jquery-if
bower install mu-jquery-if

Usage

// AMD
require(["jquery", "mu-jquery-if/jquery.if"], function($, $if) {
  $.expr[":"].if = $if($);
});

// CJS
$.expr[":"].if  = require("mu-jquery-if/jquery.if")($);

// Global
$.expr[":"].if  = window["mu-jquery-if/jquery.if"]($);
// Set the value of last to "Doe" if the value of first is "John" or "Jane"
$("input['name'='last']:if(input[name='first'][value='John'], input[name='first'][value='Jane'])").val("Doe");