Little help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Little help

I see people using $("#id_value") instead of document.getElementById. What replaces the getElementById() method? Is it the $ sign or the #?

25th Jul 2018, 12:28 AM
Emeruche Ikenna Cole
Emeruche Ikenna Cole - avatar
4 Answers
+ 14
These JavaScripts are utilizing jQuery, a library that makes using JavaScript easier. jQuery functions are accessed with the $ symbol. jQuery reads a name with a # symbol in front as an ID (like how you select IDs in CSS). If you want to learn more about jQuery, we have a lesson on it you can try! https://www.sololearn.com/Course/jQuery/?ref=app
25th Jul 2018, 12:35 AM
Tamra
Tamra - avatar
+ 8
Hey Emeruche Ikenna Cole The shortened version is using jQuery jQuery is a library for javascript, used to shorten down javascript and make it quicker to write code. It is normally better to learn javaScript first, then move onto using the jquery library. Here is the lesson on SoloLearn: https://www.sololearn.com/Course/jQuery/?ref=app Learn more: https://www.w3schools.com/jquery/jquery_intro.asp
25th Jul 2018, 12:34 AM
Agent
Agent - avatar
+ 2
The more closer one is document.querySelector("#id")
25th Jul 2018, 4:55 PM
Calviղ
Calviղ - avatar
+ 1
$ is a shortened sign of jQuery. # is a id in HTML.
28th Jul 2018, 8:44 AM
William Wee
William Wee - avatar