如何清除文本自动完成字段的值

Query of PARTICULARS/DESCRIPTION field auto-complete.

SELECT ITEMS
FROM CMS.V_MASTER_COMPEXP 
WHERE USERNAME = '[usr_name]' AND COSTCENTER_CODE = '{CHARGE_CC}' AND PLANT = '{PLANT}'
ORDER BY ITEMS

image of the auto-complete and text field

Scenario that I need:

  • When I change the PLANT, the PARTICULARS/DESCRIPTION data will be cleared or the value will be set to null.

  • When I change the CHARGE TO COST CENTER, the PARTICULARS/DESCRIPTION and PLANT data will be cleared or the value will be set to null.

Use jQuery to do this for example

<select name="FirstSelect" class="FirstSelect">
 <option value="">Default </option>
 <option value="First">First </option>
 <option value="Second">Second </option>
</select>
<select name="SecondSelect" class="SecondSelect">
  <option value="">Default1 </option>
  <option value="AnotherFirst">AnotherFirst </option>
  <option value="AnotherSecond">AnotherSecond </option>
</select>
<input type="text" value="Here is some text" class="Text">


<script type="text/javascript">
$('.FirstSelect').on('change', function() {
  $('.Text').val('');
});
$('.SecondSelect').on('change', function() {
  $('.Text').val('');
  $('.FirstSelect').prop('selectedIndex',0);
});
</script>

Jsfiddle