css - jQuery class selector "class_name" vs ".class_name" -


when looking through jquery examples, see css classes referred prepending "." , other times without. example, in snippet codecademy:

else if(event.which === 110) {   var currentarticle = $('.current');   var nextarticle = currentarticle.next();    currentarticle.removeclass('current'); 

why selector $('.current') needed in 2nd line, ('current') required in 4th line?

that convention.

on 2nd line $('.current') telling jquery search called "current" , dot specifies class. need call ".current"

on 4th line, you're telling jquery going select class using "removeclass" don't need use dot there. because "removeclass current being class"


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -