I am learning the jQuery library. I want to know how can I change the div height and width on a button click using jQuery. I was very tired of JavaScript syntaxes and very long code. Now, I am using jQuery to create my own modules.
HTML code -
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Change div block height and width on button click using jQuery</title>
<style type="text/css">
.card{
height: 200px;
width: 200;
border: 1px red;
}
</style>
</head>
<body>
<div class="card">Div block height and width</div>
<button type="button">Change Height & Width</button>
</body>
</html>
In the above code, you can see, I have a div block with initial height and width using CSS class.
Height = 200px ;
Width= 200px;
As you can check, I have created a button. How can I change the div height and width on a button click in jQuery?