How do I select a sibling element using jQuery?

前端 未结 10 1588
渐次进展
渐次进展 2020-12-05 01:29

Can you help me with this jQuery selector?

$(\".auctiondiv .auctiondivleftcontainer .countdown\").each(function () {
    var newValue = parseInt($(this).text         


        
相关标签:
10条回答
  • 2020-12-05 02:07

    you can select a sibling element using jQuery

     <script type="text/javascript">
        $(document).ready(function(){
            $("selector").siblings().addClass("classname");
        });
     </script>
    

    Demo here

    0 讨论(0)
  • 2020-12-05 02:14
    $(this).siblings(".bidbutton")
    
    0 讨论(0)
  • 2020-12-05 02:17

    Here is a link which is useful to learn about select a siblings element in Jquery.

    How do I select a sibling element using jQuery

    $("selector").nextAll(); 
    $("selector").prev(); 
    

    you can also find an element using Jquery selector

    $("h2").siblings('table').find('tr'); 
    

    For more information, refer this link next(), nextAll(), prev(), prevAll(), find() and siblings in JQuery

    0 讨论(0)
  • 2020-12-05 02:19
    $("h2").siblings().css({"color": "blue"});
    
    0 讨论(0)
提交回复
热议问题