October 22, 2024
Chicago 12, Melborne City, USA
HTML

jQuery selector for content without specific classname


This is my html markup:

<ul class="list-unstyled mb-2">
    <li class="mr-2 d-inline-block">
        <p class="m-0"><i class="fas fa-birthday-cake mr-2" aria-hidden="true"></i>Age 26-34</p>
    </li>
    <li class="mr-2">
        <p class="text-truncate m-0"><i class="fas fa-map-marker-alt mr-2"></i>City</p>
    </li>
    <li class="mr-2">
        <p class="text-truncate m-0"><i class="fas fa-calendar-alt mr-2"></i>29.10.2024 - 29.10.2024</p>
    </li>
    <li class="mr-2">
        <p class="m-0"><i class="fas fa-money-bill-alt mr-2"></i>50 USD</p>
    </li>
</ul>

Problem is that I dont know how to get content "29.10.2024 – 29.10.2024" which has before <p> with child <i> with classname "fa-map-marker-alt".
Not guaranted that all LIs exists. Sometimes is only one, sometimes only 2 LIs. Its impossible use li:nth-child.
How to do it to get it?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video