How to set background color of HTML element using css properties in JavaScript

In this article, you will learn how to set background color of HTML element using css properties in…

How to change the background color of an element in CSS

To change the background color of an HTML element is easy using the css background-color property.…

How to change the color of an element in CSS

Using the css color property, you can easily change the color of an html element. Syntax: element…

How many ways to style an html element?

There are three (3) different ways to style an HTML element using css. 1. Inline styles. 2. Inter…

HTML space between words on same line

If you are thinking to add a space between words on same line, then by using the   entity…

Split a String and Get the First Element in Javascript

In this article, you will learn how to split a string and get the first element using Javascript. …

5 attributes for an image in HTML

To embed an image in an HTML page, The <img> tag is used. The <img> tag has some attr…

How to specify the height and width for an image?

The height attribute is used to specify the height of an image. The height and width attributes a…

How to Count Words in JavaScript

Today, we will write a program that counts the number of words in a sentence entered by the user. …

Which is correct <br> or <br/>?

In HTML5, <br> tag is preferred. The <br/> tag is also accepted. But the <br>&l…

How to get dropdown selected value in jQuery by class

In this article, you will learn how to get selected value of dropdown in jQuery by class attribute…

How to get selected value of dropdown in jQuery by id

In this article, you will learn how to get selected value of dropdown in jQuery by id attribute. …

How to get selected value of dropdown in jQuery by name

In this article, you will learn how to get selected value of dropdown in jQuery by name attribute. …

Get selected value of dropdown in jQuery on change

To get the selected value of a dropdown using jQuery on change, you may use the change() method. …

How to get dropdown selected text in JavaScript

To get the selected text from a drop down <select> using Javascript, we will select the…

How to open a link on page load using Javascript

Suppose, you have an anchor ( <a> ) element. You want to open the link in a new tab after lo…

How to trigger click event without clicking in Javascript

If you want to trigger click event without clicking a button manually, then you should use the clic…

How to detect which one of the defined font was used in a web page using Javascript

In this article, you will learn how to detect which font was used in a particular element using Ja…

What is the HTML code for a space?

To add one or more space in HTML, you should use the &nbsp; html entity.

How to calculate text width based on font size JavaScript

To calculate text width using Javascript, You need to use the canvas.measureText() method. De…

Onclick function being called when page loads

Calling a function when page loads is as easy as to cut a cake. Use the click() method to click a…

How to add multiple classes to an Element using Javascript

To add multiple classes to an Element, we can use the classList. add() method. The classList.add()…

© 2019 - 2022 ‧ 3schools All Rights Reserved.