Difference between getElementById and jquery $('#smth')

前端 未结 4 1476
猫巷女王i
猫巷女王i 2020-12-29 21:19

What\'s the difference between classic Javascript code:

document.getElementById(\'theID\')

and the jQuery version:

$(\'#the         


        
4条回答
  •  借酒劲吻你
    2020-12-29 21:41

    Make sure to include

    In your

    If you don't load jQuery then you cannot use $ as jQuery is an external library and not part of JavaScript.

提交回复
热议问题