Select Matching Parent .parent()

.parent()

e.g. $("b").parent("div")

.parent(selector) will find the first matching parent.

Example 1: $("b").parent() will find the first direct parent of <b>.
<div>
  <span>
    <b>a</b>
  </span>
  <div>
    <b>b</b>
  </div>
</div>
Example 2: $("b").parent("span") will find the first direct <span> parent of <b> .
<div>
  <span>
    <b>a</b>
  </span>
  <div>
    <b>b</b>
  </div>
</div>
jQuery traversing tree .parent()