Categories
JavaScript Selecting

JavaScript for optimizers #29: How to select multiple element types?

Example

Select multiple element types:

let h1AndParagraphs = document.querySelectorAll("h1, p");
console.log(h1AndParagraphs);

Try it out for yourself by going to the testing page and running the code in the browser console.

Categories
JavaScript Selecting

JavaScript for optimizers #28: How to select the first element after another element?

Example

Select the first element after another element:

let formAfterDivider = document.querySelector("hr + form");
console.log(formAfterDivider);

Try it out for yourself by going to the testing page and running the code in the browser console.

Categories
JavaScript Selecting

JavaScript for optimizers #27: How to select an element type that has a class?

Example

Select an element type that has a class:

let leadParagraph = document.querySelector("p.leadParagraph");
console.log(leadParagraph);

Try it out for yourself by going to the testing page and running the code in the browser console.

Categories
JavaScript Selecting

JavaScript for optimizers #26: How to select an element type?

Example

Select an element type:

let getParagraph = document.querySelector("p"); 
console.log(getParagraph);

Try it out for yourself by going to the testing page and running the code in the browser console.

Categories
JavaScript Selecting

JavaScript for optimizers #25: How to select an element with multiple classes?

Example

Select an element with multiple classes:

let testImage = document.querySelector(".classOne.classTwo");
console.log(testImage);

Try it out for yourself by going to the testing page and running the code in the browser console.

Categories
JavaScript Selecting

JavaScript for optimizers #24: How to select elements with ids?

Example

Select an element with an id:

let testImage = document.querySelector("#imageElement");
console.log(testImage);

Try it out for yourself by going to the testing page and running the code in the browser console.

Categories
JavaScript Selecting

JavaScript for optimizers #23: How to select an element with a class?

Example

Select an element with a class:

let testImage = document.querySelector(".wp-image-1596");
console.log(testImage);

Try it out for yourself by going to the testing page and running the code in the browser console.

Categories
Action JavaScript Styling

JavaScript for optimizers #22: How to change CSS with JavaScript?

Sometimes you need to make visual changes to elements when creating your a/b tests with JavaScript. You don’t always have a developer that can set up a style sheet for you. So the question might arise: How to change CSS with JavaScript? This is what I will teach you in this article.

Categories
JavaScript Working with code

How long does it take to learn JavaScript?

Some can learn JavaScript in a couple of months while others need years to grasp the subject. How long does it take you to learn JavaScript? This really depends. Let’s try to break it down.

Categories
Action Changing JavaScript

JavaScript for optimizers #21: Testing the right mobile keyboard with credit card fields

In this article, we will be testing the right mobile keyboard for credit cards according to Baymard. It involves getting the right input mode, setting a pattern, disabling validation, disabling auto-correction, and setting the right autocomplete.