How to change the text alignment using jQuery ?
In this article, we will see how to change the text alignment of an element using jQuery. To change the text alignment of an element, we use css() method.
The css() method is used to change the style property of the selected element.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
In the below example, first, we create a <h3> element containing an id attribute and also creating a button element. When the user clicks on the button, the css() method is called and this method sets the text-align property value to the center.