This is the div on the site for a particular booking – in this example the number 7568 is the tour ID.
<div class="tourmaster-template-wrapper" id="tourmaster-payment-template-wrapper" data-ajax-url="https://www.domainname.co.uk/wp/wp-admin/admin-ajax.php" data-booking-detail="{"tour-id":"7568"} >
For particular tour ID’s I would like to hide another div on the page so is there a way to apply CSS to another div on the page if the data-booking-detail includes certain numbers?
So if data-booking-detail includes 7568 then hide div that offers book now and pay later.
2
Answers
You can use CSS to hide a div based on the presence of a specific number in the data-booking-detail attribute. However, CSS alone cannot directly manipulate attributes or their values. You’ll need to use JavaScript or jQuery to achieve this functionality.
Here’s an example of how you can achieve this using JavaScript:
First, select the specific element. In your case, that element has the ID
tourmaster-payment-template-wrapper
and you are looking for the attributedata-booking-detail
that contains the value7568
.This is an example of how you could hide the second element: