Improve Inefficient Jquery Selector
In IntelliJ, if I use a jQuery selector such as: $('#roleField option').each(function() { // impl omitted }); The selector is highlighted with a suggestion that I should spli
Solution 1:
From the jquery documentation this method will not go through the Sizzle sector engine:
$('#roleField option').each(function() {
// No Sizzle
});
Where this one will:
$('#roleField').find('option') // Sizzle!
Look at the ID base selectors section here. Hence the second method will be faster than the first.
Solution 2:
Try to use .find()
here:
$('#roleField').find('option').each(function() {
// impl omitted
});
Your warning seem like related to efficiency of the selector.
Post a Comment for "Improve Inefficient Jquery Selector"