I learned that using a reference variable is faster than using $() every line of code (see my previous question): jQuery - Is it okay to use $('#ElementId') everytime?. Now my question is how can I use this reference variable to maximize the power of jQuery? Please see the example below:
Without reference variable:
var ValueOfSelected = $('#SelectElementId option:selected').val();
With reference variable (pseudo-code):
var SelectElement = $('#SelectElementId');
var ValueOfSelected = $(SelectElement).SelectedOption.val();
Note that SelectedOption.val() is the pseudo-code here. Is there such function anyway?
$(SelectElement)again, you can just useSelectElementdirectly.