javascript - How to set height of parent, dependent on height of selected element -


I have a scenario where I want to get all the elements with a certain class, and then I want to use the parent div < P>

  Lt; Div squared = 'a' & gt; & Lt; Div square = 'b' & gt; & Lt; Div squared = 'c' & gt; ......... & lt; / Div & gt; & Lt; Div class = 'd' & gt; ......... & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div square = 'b' & gt; & Lt; Div squared = 'c' & gt; ......... & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div square = 'b' & gt; & Lt; Div squared = 'c' & gt; ......... & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div square = 'b' & gt; & Lt; Div class = 'd' & gt; ......... & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

I want to search all the class D objects, and then I want to set the padding bottom value of my container class B , the height of the class D in question, plus the padding-bottom value that is currently near the B object.

< Ol>
  • Note that all classes have different elevations of D objects.
  • Each class can be a maximum of 1 class B . D
  • Maximum
  • ?

    Try it out:

      $ ('D'). Each (function () {$ (this) .Parent (). Css ("paddingbottom", "+ =" + $ (this) .height () + "px");});  


    Comments

    Popular posts from this blog

    import - Python ImportError: No module named wmi -

    Editing Python Class in Shell and SQLAlchemy -

    c# - MySQL Parameterized Select Query joining tables issue -