+ 1

I have a doubt on using jQuery variables.

let divE = $('div'); In jQuery, we know that the variable div, will have a DOM element in it! But what is the correct way of accessing the variable later in code? 1. $(divE); 2. $divE; 3. $.divE;

14th May 2019, 7:05 AM
Ă‡ĆŻĆ™ĂźĂ¶ĆŸ ĂŸÄ…ĆĄĂ€Ă±È› 🇼🇳
Ă‡ĆŻĆ™ĂźĂ¶ĆŸ ĂŸÄ…ĆĄĂ€Ă±È› 🇼🇳 - avatar
3 Answers
+ 1
Just divE. Exactly as you declared it with the let statement.
14th May 2019, 8:12 AM
Adam
Adam - avatar
+ 1
So if I want to get the text of div element, should I have to write divE.text()?
14th May 2019, 8:31 AM
Ă‡ĆŻĆ™ĂźĂ¶ĆŸ ĂŸÄ…ĆĄĂ€Ă±È› 🇼🇳
Ă‡ĆŻĆ™ĂźĂ¶ĆŸ ĂŸÄ…ĆĄĂ€Ă±È› 🇼🇳 - avatar
0
Yup.
14th May 2019, 11:43 PM
Adam
Adam - avatar