JQuery remove () on element does not hide used space

I delete the element with remove()(this is a <li>c display: inline;, although the same problem exists with display: block;), and while the element is removed from the page, this space did not take up.

Is this the standard behavior, so should I use a different method? <li>contains a form field, so I want ideally not to have this form field sent to the server, so use remove()instead hide().

+3
source share
2 answers

What you experience is not standard behavior. When you remove an item from the DOM, you must also remove the occupied space.

+4

. . , / , , .

:

<div id="one">Blah Blah</div>
<br/>
<div id="two">Blah Blah</div>
<br/>
<div id="three">Blah Blah</div>
<br/>
<div id="four">Blah Blah</div>

/ div id "three", 3 .

, 20 , 20 , .

, divs 'padding'

+2

Source: https://habr.com/ru/post/1720459/


All Articles