I'm trying to use a variable in place of a selector.
Here's the code without the variable
$('.registerForm #firstName').on('focusout', function() {
I want to swap out .registerForm for a var called thisForm
and set thisForm = .registerForm
I tried several variations of what's below, but it's not doing anything. When I call the page with the code and check the source, it's not interpreting it. It's just producing the exact code I used.
$(+thisForm + '#firstName').on('focusout', function() {
Thoughts?
Here's the code without the variable
$('.registerForm #firstName').on('focusout', function() {
I want to swap out .registerForm for a var called thisForm
and set thisForm = .registerForm
I tried several variations of what's below, but it's not doing anything. When I call the page with the code and check the source, it's not interpreting it. It's just producing the exact code I used.
$(+thisForm + '#firstName').on('focusout', function() {
Thoughts?