JSFiddle - React, Tailwind, and code Playground

by Peter Doyle

HTML

<a href="parent/url">
    This is the parent link.<br/>
    
    <button class="booking-link" data-url="child/url">This is the child Url</button>
    
</a>

JavaScript

$(document).ready(function(){
  
          $("a").click(function(e){
              e.preventDefault();
              var newURL = $(this).attr("href");
              var target = $(e.target);
              
              if(target.hasClass("booking-link")){
                  newURL = target.attr("data-url");
              }
              
              alert("a clicked, url = "+newURL);
        
          })
  
})