JQuery Newbie Need Help

Hi guys, need some help with some jQuery code, new to jQuery ... Check the HTML code now by entering the script code of the file, 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 someone explain what the $ workEntryForm is assigned?

+3


source to share


1 answer


The syntax contains a selector

$("[rel*=js-work-entry-form")

selects all elements that contain an attribute rel

with a string js-work-entry-form

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 IDs one

, two

and three

since those elements have a rel attribute that is part of the selection.

+1


source







All Articles