How jquery removes the float attribute
This article is a detailed introduction to "jquery how to remove float attribute". The content is detailed, the steps are clear, and the details are properly handled. I hope this article "jquery how to remove float attribute" can help you solve your doubts. The following is a detailed introduction to "jquery how to remove float attribute". Let's learn new knowledge together.
Two methods: 1. Set the float attribute with css(), change the value to "none", syntax "element.css("float","none")". 2. Use attr() to control the style attribute and set the new style, syntax "element.attr("style","float:none")".
This tutorial operates on Windows 7, jquery version 1.10.2, Dell G3 computers.
The float attribute is used to specify whether a box (element) should float.
This property has no effect when it has a value of none (the element does not float and appears where it appears in the text.)
In jquery, you can remove the float attribute by setting its value to none.
Two methods are described below:
Use CSS()
The css() method returns or sets one or more style properties of the matching element.
$(document).ready(function() { $("button").click(function() { $("img").css("float","none"); }); }); img { float:right; }
In the following paragraph, we added a float:right image. This causes the image to float to the right of the paragraph.
Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts. Here are some texts.
Remove float
2. Use attr()
Use attr() method to control style attribute and set new float style
$(document).ready(function() { $("button").click(function() { $("img").attr("style","float:none"); });});
Read here, this article "jquery how to remove the float attribute" article has been introduced, want to master the knowledge points of this article also need to be used by yourself to understand, if you want to know more related content of the article, welcome to pay attention to the industry information channel.