How to increase the size of a division when you click it using jQuery ?

In this article, we will learn how to increase the size of a division when you click on it using jQuery.

1. Code:

$(".box").click(function () {

  // Select the clicked element
  let curr_elem = $(this);

  // Get the current dimensions
  let curr_width = curr_elem.width();
  let curr_height = curr_elem.height();

  // Set the new dimensions
  curr_elem.height(curr_height * increase_modifier);
  curr_elem.width(curr_width * increase_modifier);
});

2. Example:

Run the program to get the result.



  
  


  

Soltuts.com

How to increase the size of a division when you click it using jQuery?

Click on a div to increase its size