Jess McKenzie Jess McKenzie - 1 month ago 17
jQuery Question

Overriding a form value using jQuery

Currently I have this form and what I am wanting to do when number 5 is clicked/selected how could I make that load another url and ignore whats happening within the form.

Form:

<div id="reservation-widget-wrap">
<div id="reservation-widget-header">Check Building Availability</div>
<div id="reservation-widget-content">
<form action='https://www.thebookingbutton.com.au/properties' method='get'>
<label for='channel_code' class="caption">Select property </label>
<select id='channel_code' name='id'>
<option value='1'>One</option>
<option value='2'>Two</option>
<option value='3'>Three</option>
<option value='4'>Four</option>
<option value='5'>Five</option>
</select>

Answer
$(document).ready(function(){

    $('#channel_code').change(function(){

        if($('#channel_code').val() == '5'){

            window.location.href = 'Your URL';

        }

    });

});
Comments