variables in jQuery vs Javascript

This question already has an answer here:

  • Why would a JavaScript variable start with a dollar sign? 16 answers

  • You can also have $variable in Javascript. jQuery is just a library that uses $ to make library and non-library functions easier to distinguish.


    There is no requirement to prefix jQuery variable names with $. It is merely a convention to indicate that the variable is a jQuery object/collection.


    There is no need to do it and seems terrible to use it like this. You are declaring a variable with the name including the $ symbol.

    链接地址: http://www.djcxy.com/p/94964.html

    上一篇: 声明变量javascript

    下一篇: jQuery vs Javascript中的变量