diff --git a/snippets/currentURL.md b/snippets/currentURL.md index a8eb34eac..173fffda1 100644 --- a/snippets/currentURL.md +++ b/snippets/currentURL.md @@ -5,7 +5,7 @@ tags: browser,url,beginner Returns the current URL. -Use `window.location.href` to get current URL. +Use `window.location.href` to get the current URL. ```js const currentURL = () => window.location.href; @@ -13,4 +13,4 @@ const currentURL = () => window.location.href; ```js currentURL(); // 'https://google.com' -``` \ No newline at end of file +``` diff --git a/snippets/insertAfter.md b/snippets/insertAfter.md index 7b105279a..695e9455e 100644 --- a/snippets/insertAfter.md +++ b/snippets/insertAfter.md @@ -12,5 +12,6 @@ const insertAfter = (el, htmlString) => el.insertAdjacentHTML('afterend', htmlSt ``` ```js -insertAfter(document.getElementById('myId'), '
after
'); //after
-``` \ No newline at end of file +insertAfter(document.getElementById('myId'), 'after
'); +//after
+``` diff --git a/snippets/insertBefore.md b/snippets/insertBefore.md index 3a0f52f21..dc20ba6ca 100644 --- a/snippets/insertBefore.md +++ b/snippets/insertBefore.md @@ -12,5 +12,6 @@ const insertBefore = (el, htmlString) => el.insertAdjacentHTML('beforebegin', ht ``` ```js -insertBefore(document.getElementById('myId'), 'before
'); //before
before
'); +//before
element on the page will have a font-size of 20px -``` \ No newline at end of file +setStyle(document.querySelector('p'), 'font-size', '20px'); +// The first
element on the page will have a font-size of 20px +``` diff --git a/snippets/toggleClass.md b/snippets/toggleClass.md index 3beb7f574..6dfbecc84 100644 --- a/snippets/toggleClass.md +++ b/snippets/toggleClass.md @@ -3,7 +3,7 @@ title: toggleClass tags: browser,beginner --- -Toggle a class for an element. +Toggles a class for an HTML element. Use `element.classList.toggle()` to toggle the specified class for the element. @@ -12,5 +12,6 @@ const toggleClass = (el, className) => el.classList.toggle(className); ``` ```js -toggleClass(document.querySelector('p.special'), 'special'); // The paragraph will not have the 'special' class anymore -``` \ No newline at end of file +toggleClass(document.querySelector('p.special'), 'special'); +// The paragraph will not have the 'special' class anymore +```