So I Want my page to redirect to different page when a specific value of select is chosen. Whether it changes the value or not. If the value is already some other value the on Change works fine but if the value is already selected as the value which redirects the page it doesn't works for example
<script>
$("select").on('change', function() {
if ($(this).val() == 'option2') {
var data = $(this).attr("data_val");
var sid = $(this).parent().parent().children()[3];
var sid_value = $(sid).children()[0].value;
window.location = 'new.php?data=' + data + '&sid=' + sid_value;
}});
</script>
if the select is set to option1 and i select option2 from the dropdown then the page redirects but when the option2 is already selected in the select and i open the dropdown again & click on option2 it doesn't redirect, please help me to achieve this.