简体   繁体   中英

Automatic page redirect with select

I want it to automatically go to the next page when select is checked.

$htmlSelect=
'
<a href="#" class="bs-button bs-button-style-2 '.($data['vehicle_selected_id']==$data['vehicle_id'] ? 'bs-state-selected' : null).'">
'.esc_html__('Select','booking-system').'
<span class="chbs-meta-icon-tick"></span>
</a>            
';
}

Manual next page button

<a href="#" class="bs-button chbs-button-style-1 bs-button-step-next">
<?php echo esc_html($this->data['step']['dictionary'][2]['button']['next']); ?>
<span class="bs-meta-icon-arrow-horizontal-large"></span>
</a> 

I want to switch to automatic page when select is checked. How should I edit $htmlSelect?

I checked your page. If you include the code below in the script tags in the choose vehicle page, your request will work.

document.querySelector('.chbs-button-style-2').addEventListener("click", function() {
    document.querySelector('.chbs-button-step-next').click();
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM