Tutorials Algorithms Analysis of Algorithms Data Structures Languages Interview Corner GATE ISRO CS UGC NET CS CS Subjects Web Technologies Student Jobs
Method 1: Using the css() method: The css() method is used to get or set CSS properties of a selected element. It takes two arguments, the first argument is the property that has to be set and the second argument is the value that it has to be set to.
Đang xem: How to remove style added with the
The ‘top’ value can be effectively disabled by using the ‘initial’ value which would set the property to its default value. This is similarly done with the ‘left’ value. This will remove the effect of the ‘top’ and ‘left’ values in the element.
Syntax:
Before clicking the button:
After clicking the button:
Method 2: Using the top and left properties: The top and left value can be changed by accessing these properties with the help of the style property of the element. The required element is first selected using a jQuery selector. The style property and its ‘top’ and ‘left’ values are then accessed using the dot notation on the selected object.
The ‘top’ value can be effectively disabled by using the ‘initial’ value which would set the property to its default value. It is similarly done with the ‘left’ value. This will remove the effect of the ‘top’ and ‘left’ values in the element.
Syntax:
Output:
Before clicking the button:
After clicking the button:
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy Got It !