Loading CSS Stylesheet on Demand Through Its disabled Attribute
A stylesheet can include the disabled attribute in its markup to prevent it from being downloaded on page load. Later when the stylesheet needs to loaded on demand, its disabled attribute can be removed with Javascript.
Numeric Separators in Javascript to Improve Readability of Large Numbers
Numeric separators can be used to improve readability of large numbers. For example the number 111111111111111111111111, which is difficult to read, can be alternately written as 111_111_111_111_111_111_111_111
Preventing Autofilling the Password Field in HTML Forms
To prevent situations where we would not like the browser to autofill the password field in a form, the autocomplete=new-password attribute can be used.
Performance Tip : Learning to Think Beyond the Main Thread (VIDEO)
If Javascript code executed on the main thread could be offloaded to several Web Workers, then performance problem of a web application would be solved almost completely.
Detecting Change in Playing Subtitles Text for 〈video〉Element
Sometimes we would like to detect when the subtitles change in the playing video. This can be done by listening to the cuechange event on the 〈track〉element.
Preserving Context of this Inside AJAX Response Callbacks in jQuery
It is very common to access current this context inside jQuery AJAX's response callbacks (success or error). This tutorial describes 3 ways of doing this.
Representing Edits to HTML Pages using〈ins〉&〈del〉Tags
Often there are edits made to documents. In HTML these changes can be highlighted using the 〈ins〉and 〈del〉 tags.
CSS Selector to Select Elements Not Having Certain Class / Attribute / Type
Many times it may be required to select elements that are not having a specific class, attribute, id etc. This can be achieved using the CSS :not pseudo-class selector.
Checking whether Page is Opened / Active in Browser Tab
The Page Visibility API can be used to check whether a browser tab is active or not, i.e. if the page is in view or hidden from view.
Improving〈canvas〉Performance with OffscreenCanvas (VIDEO)
Performance of the 〈canvas〉element can be greatly improved using the newly introduced OffscreenCanvas. This can offload canvas logic and rendering to a background process rather on the main browser thread.
HTML Tables with Fixed Header on Scroll using position: sticky
Making table header row fixed on page scrolling was once quite a complicated problem that was somehow achieved with Javascript. But now it can be achieved easily using CSS with position: sticky.
HTML Tags to Represent Programing Code
The 〈code〉, 〈kbd〉, 〈samp〉 and 〈var〉 HTML tags can be used to represent programming and code information in a webpage.
How to Get List of All Google Fonts (PHP)
The list of all Google Fonts can be retrieved using the Google Fonts Developer API.
How to Load Google Fonts with JavaScript
Google Fonts can be loaded through Javascript using the Web Font Loader Library. Events are also triggered when fonts are being loaded, or when they are rendered.
Converting Timestamp to Date & Time in Javascript
A UNIX timestamp can be converted to the required date and time formats in Javascript using the Date() object and its methods.
Looping through querySelectorAll() with Javascript
List of nodes returned by querySelectorAll() can be looped through using the forEach() method of the returned NodeList object.
Differences between 〈script type=module〉and〈script〉
Whenever a Javascript module needs to be applied to HTML, we need to do it within a 〈script type=module〉 tag. However there are some difference in Javascript execution in this tag vs a normal 〈script〉tag.
Difference Between Pseudo-Class and Pseudo-Element in CSS
Pseudo-class and pseudo-element are both CSS selectors, however pseudo-class represents a virtual CSS class, whereas pseudo-element represents a virtual HTML element.
Loop through〈select〉Options with Javascript
Options of a dropdown 〈select〉element can be looped over its options property. This property gives a list of all 〈option〉elements inside it.
How to Change Placeholder Color for Textboxes
Color of the text specified by the placeholder attribute in input fields can be changed using the ::placeholder CSS selector.