The Vanilla JS equivalent of jQuery's text() method would be to set the textContent property of a DOM element.


Vanilla JS equivalent of jQuery css
17 Feb, 2023
In jQuery, you can set CSS properties on an element using the css() method. To achieve the same thing in vanilla JavaScript, you can use the style property of the element.

Vanilla JS equivalent of jQuery attr
17 Feb, 2023
In jQuery, the attr method is used to get or set the value of an attribute for an element. In vanilla JavaScript, you can use the getAttribute and setAttribute methods to achieve the same...

Is the current page an admin page in Drupal 7
8 Feb, 2023
It's preferable to determine if the page is an admin page by checking the active theme, as it provides a comprehensive solution, rather than relying on the URL path. This approach assumes that the...

Vanilla JavaScript equivalent of jQuery click
13 Jan, 2023
In vanilla JavaScript, the equivalent of the jQuery click function would be the onclick property. The onclick property in JavaScript is an event property of HTML elements that allows you to specify a...

in_array equivalent in JavaScript
12 Jan, 2023
In JavaScript, the equivalent of the PHP function in_array() is the includes() method, which is used to check if an array contains a certain value.
Get all nodes with attribute that exists in xPath
10 Jan, 2023
Get all nodes that have a defined attribute in xPath. Explanation of commands: "//" selects nodes in the document from the current node that match the selection no matter where they are."*" is a...

Vanilla JS equivalent of jQuery prepend
2 Jan, 2023
Insert content to the beginning of an element. Vanilla JS equivalent prepends to a single element, to prepend to multiple elements you need a loop. Same applies to append.

Vanilla JS equivalent of jQuery find
30 Dec, 2022
The Vanilla JavaScript equivalent of jQuery's .find() method is the .querySelectorAll() method. The function allows us to search through the descendants of these elements in the DOM tree and...

Redirect all subdomains to main domain using .htaccess
13 Nov, 2022
Redirect all subdomains to main domain using .htaccess. Using some sort of a mass-hosting provider, you never know what they might change in your DNS automatically. This is a backup solution to make...