I need to select the previous element using only a jQuery selector.
<li class="collapsable">
    <div class="hitarea collapsable-hitarea"></div>
    <span id="devicelist" class="ankr">Device List</span>
    <ul id="ultree">
        <li type="dev" device="/dev/sdh1" id="dev0" class="litab">
            <img height="20px" width="20px" src="../Images/drive.png" class="dicon">
            <a class="ankr dn" href="#">'/dev/sdh1'</a>
        </li>
    </ul>
</li>
$(document).on("click","#devicelist,**Here Selector will be used**",this,function(event){
    console.log(this);
    console.log(event.target);
});
I want to select div which has class .hitarea. I am looking for something like $("#devicelist:div.hitarea")
It should be done only with a selector of jQuery.
you can use the prev() selector
Description: Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.
$('#devicelist').prev();
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With