onclick attribute is not working on mobile

onclick attribute is not working on mobile

Hi,
please I have this code
  1. <optgroup label="Service Group">
  2.       <option class="dropdown-item" onclick="testFunction()">service 1</option>
  3. </optgroup>
and when I click on this option from desktop, testFunction runs perfectly, but when I click on it from my mobile browser nothing happens.

  1. function testFunction() {
        jQuery('#test.recommend_link').show();
        jQuery('.recommend_link').not('#test').hide();
    }

How could I solve this problem??