How do I select a sibling element using jQuery?

前端 未结 10 1612
渐次进展
渐次进展 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:00

    jQuery provides a method called "siblings()" which helps us to return all sibling elements of the selected element. For example, if you want to apply CSS to the sibling selectors, you can use this method. Below is an example which illustrates this. You can try this example and play with it to learn how it works.

    $("p").siblings("h4").css({"color": "red", "border": "2px solid red"});

提交回复
热议问题