skip to Main Content
<button class="proceed">
    <div class="text-sm-bold clr-white" onclick="proceedBook()">PROCEED FOR BOOKING</div>
</button>
<button id="hid-cb" hidden type="submit" class="proceed-btn" name="conform-booking">PROCEED FOR BOOKING</button>

const proceedBook= ()=>{$("#hid-cb").click()}

$("#hid-cb").click() not work in mobile

instead i use jQuery vclick

const proceedBook= ()=>{$("#hid-cb").vclick()}

error: Uncaught TypeError: $(…).vclick is not a function

2

Answers


  1. const proceedBook = () => {
    $("#hid-cb").trigger('click');
    } 
    

    This will trigger the ‘click’ event on the hidden button when the proceedBook() function is called.

    For mobile compatibility, ensure that your mobile environment supports the events you’re using. Sometimes, certain events might behave differently on mobile browsers, and you may need to use touch events or other mobile-specific events.

    const proceedBook = () => {
    // Check for mobile and trigger appropriate event
    if (/Mobi/.test(navigator.userAgent)) {
        $("#hid-cb").trigger('touchstart'); // Use touchstart for mobile
    } else {
        $("#hid-cb").trigger('click'); // Use click for non-mobile
    }
    }
    
    Login or Signup to reply.
  2. const proceedBook = () => {
    $("#hid-cb").trigger('click');
    }
    
    const proceedBook = () => {
    $("#hid-cb").trigger('click');
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search