I am trying to create anchor tag on <span> element. Here is my code:
$(function() {
$("span.bold_option_value_title:contains('I Booked An Appointment')").click(function() {
window.open('https://regentrepair.com/pages/book-your-repair', '_blank');
})
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<span class="bold_option_value ">
<label>
<span class="bold_option_value_element">
<input type="checkbox" class="cbm_1690320_664816" value="I Booked An Appointment " data-option_value_key="0">
</span>
<span class="bold_option_value_title">I Booked An Appointment </span>
</label>
</span>
I am putting the code in theme.liquid file before the body closing tag but it is not working.
I tried this code in console without $(function()) this code is working but if i put it in theme.liquid it is not working. I also tried "Onload" but still no success.
Can you please tell me what I am doing wrong?
Thank you.