$(document).ready(function() {
$('select').change(function() {
$('option[value=' + $(this).val() + ']').attr('disabled', 'disabled');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<select id="1">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
</select>
<select id="2">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
</select>
I want to apply this code in my php file and i haven't studied jQuery so i copy pasted the code on my notepad saved it with .php extension and ran it on localhost but only html part is running and the script is not working. Please help i know its a childish question but i am trying to learn.
Just add:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
and try and use js extension and include it in your php