Aki G
Aki G

Reputation: 39

jQuery Newbie, need some assistance

Please check the HTML code now. Entering the script file code, I don't know what these lines do:

$workEntryForm = $("[rel*=js-work-entry-form");
$workEntrySelectProject = $workEntryForm.find("[rel*=js-select-project]");
var $workEntryForm, $workEntrySelectProject;

can anyone explain, what is assigned to the $workEntryForm?

Upvotes: 2

Views: 83

Answers (1)

Sushanth --
Sushanth --

Reputation: 55750

The syntax is attribute contains selector

$("[rel*=js-work-entry-form") selects all the elements which contains the rel attribute with js-work-entry-form string as part of the value.

<div id="one" rel="prefix-js-work-entry-form"></div>
<div id="two" rel="js-work-entry-form-suffix"></div>
<div id="three" rel="prefix-js-work-entry-form-suffix"></div>
<div id="four" rel="prefix"></div>

In the above HTML it selects divs with id's one, two and three as these elements have the rel attribute which is part of the selection.

Upvotes: 1

Related Questions