0

How to write this code simpler?

I am new to Javascipt and I wanted to write the same code just easier I do not know what is the "

quot; sign :( (function($) { var tabs = $(".tabs li a"); tabs.click(function() { var content = this.hash.replace('/',''); tabs.removeClass("active"); $(this).addClass("active"); $("#content").find('p').hide(); $(content).fadeIn(200); }); });

13th Mar 2017, 4:32 PM
Robert Koronny
Robert Koronny - avatar
2 ответов
+ 8
if you are new to js then you should start with such a complicated code! Btw this is jquery so it might be confusing for you if you complete the html, css, js and jquery sololearn course you will understand that code
13th Mar 2017, 5:02 PM
Kamil
Kamil - avatar
+ 1
Like Kamil said it's just jQuery syntax, let's read about jQuery library and complete SoloLearn jQuery course :) "
quot; sign in jQuery is like document.getElement... in JS :) But in JS you need to use a long syntax to get any element with ID: document.getElementById('test'); In jQuery it's easy: $(#test); #test - because like in CSS the element ID .test - element by Class body - element by Tag Name I hope I give you some help :)
15th Mar 2017, 12:07 PM
Wiktor K.
Wiktor K. - avatar