What is the official correct way to declare jQuery variables

0 votes
I am trying to learn jQuery. I keep seeing people using different methods of declaring variables.

I have seen var variable;, var $variable;, and $variable;. Which one (if any of these) is the official correct way to declare jQuery variables.
Jun 2 in JQuery by Edureka
• 13,640 points
118 views

1 answer to this question.

0 votes

Declare a variable using the var keyword. Initialize using the = symbol. Example: var hText = "This is just some text." - Click on the heading to see the text displayed in the <p> elements. $(document).

answered Jun 2 by Edureka
• 13,640 points

Related Questions In JQuery

0 votes
1 answer

Is this the Correct Way to Access Array Elements in jQuery?

Array elements are accessed by using an integer ...READ MORE

answered Jun 13 in JQuery by rajatha
• 7,040 points
17 views
0 votes
1 answer

What is the equivalent of jQuery .hide() to set visibility: hidden

Hello Kartik, There isn't one built in but ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,740 points
6,039 views
0 votes
1 answer

What is the difference between jQuery: text() and html() ?

Hello @kartik, The text() method entity-escapes any HTML that is ...READ MORE

answered Nov 25, 2020 in JQuery by Niroj
• 82,740 points
155 views
0 votes
1 answer

What is the difference between AJAX with JavaScript and jQuery?

JavaScript is a programming language. JQuery is ...READ MORE

answered May 30 in JQuery by gaurav
• 17,000 points
63 views
0 votes
1 answer

Using setTimeout to delay timing of jQuery actions

The JavaScript setTimeout () function  is used ...READ MORE

answered May 30 in Java by gaurav
• 17,000 points
64 views
0 votes
1 answer

Best cross-browser method to capture CTRL+S with JQuery?

$(window).keypress(function(event) { if ...READ MORE

answered May 30 in JQuery by gaurav
• 17,000 points
83 views
0 votes
1 answer

jQuery.inArray(), how to use it right?

The jQuery inArray() method is used to find ...READ MORE

answered Jun 1 in JQuery by Edureka
• 13,640 points
29 views
0 votes
1 answer

Which keycode for escape key with jQuery

27 is the code for the escape key. ...READ MORE

answered Jun 1 in JQuery by Edureka
• 13,640 points
64 views
0 votes
1 answer

How to change color of SVG image using CSS (jQuery SVG image replacement)?

Edit your SVG file, add fill="currentColor" to ...READ MORE

answered Jun 1 in JQuery by Edureka
• 13,640 points
244 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP