JSFiddle - React, Tailwind, and code Playground

by deepak sisodiya

HTML

<div style="border: 1px solid black;">
    <p>This is the first paragraph in a div.</p>
    <p>This is the last paragraph in a div.</p>
</div>
<br>
<div style="border: 1px solid black;">
    <p>This is the first paragraph in another div.</p>
    <p>This is the last paragraph in another div.</p>
</div>

JavaScript

// jquery traversing last() method

$("div p").last().css("background-color","yellow");