$(function() {
var services = [
"Water Wash",
"Tyre Puncture"
];
var servicesCar = [
"Car Wash",
"Tyre Puncture",
"Vehicle Diagonstics",
"Other Repairs",
];
$('#ServiceType').autocomplete({
if($('#VehicleType').val() == '4w') {
source: servicesCar,
minLength: 0,
scroll: true
}
else {
source: services,
minLength: 0,
scroll: true
} }).focus(function() {
$(this).autocomplete("search", "");
});
});
I need to check whether the option value is 2w or 4w and based on that value, I should display the source tags. But, this code is not autocompleting the input
<select id="VehicleType" name="VehicleType">
<option value="2w"> Bike </option>
<option value="4w"> Car </option>
</select>
Here is my HTML code
ifcondition inside it, Whereas, I need to check the condition and then send source tags