I am constructing a selector on every radio button click. Since I am using the table repeatedly on every radio click, I cached it like:
var $t1 = $("#tableone");
but inside the radio check event, I need to retrieve the selector to construct a string.
Approach 1:
$radio.click(function () {
var temp = $t1.selector + " ." + $(this).attr("mobnum");
Note: If I do not $t1.selector, it comes as [object][Object] which I do not want, so I have to use $t1.selector.
Since I am using $t1.selector to construct temp every time radio is clicked, is there still a benefit caching the table at the beginning?
Approach 2:
$radio.click(function () {
var temp = $("#tableone") + " ." + $(this).attr("mobnum");
Which one's better?
.selectoris deprecated, and may be removed from jQuery in the future. \$\endgroup\$