Hello, I can not understand why the handler does not work ... as soon as I did not try. tried this:

<script lang="javascript"> $('#selectInput1').click(alert('1')); </script> 

still tried this:

 <script src = "js/functions.js"></script> 

functions.js:

 $(document).ready(function(){ var ajaxFormOptions = { success: showResponse, resetForm: true }; $('selectInput1').click(function(){alert('lol');}); } 

The form:

 <div class="form-group"> <label for="text">Имя отправителя</label> <div class="jq-selectbox jqselect"> <input id="selectInput1" class="form-control"></input> <div id="SelectDropdown1" class="jq-selectbox__dropdown" style="position: absolute; display:none"> <ul style="position: relative; list-style: none; overflow: auto; overflow-x: hidden;"> <li>1</li> <li>2</li> <li>3</li> </ul> </div> </div> <p class="help-block">Имя или номер</p> </div> 
  • one
    jquery hooked up? $('#selectInput1').click(function() { alert('lol'); }); - Mr. Black
  • @Doofy <script src = "js/jquery-1.12.3.min.js"></script> <script src = "js/jquery.form.min.js"></script> <script src = "js/bootstrap.min.js"></script> <script src = "js/functions.js"></script> while viewing the code of the page, the console does not generate errors - Anton Burak

1 answer 1

The variant from function.js looks the best. Only the selector needs to be made with #, all the same id.

  • It seems to have been sealed somewhere ... I did it with #, everything didn’t work exactly the same, but now, when I was giving you an example, I wrote everything again, I didn’t copy it. then I copied an example from here, put it in a program and it all worked) thanks - Anton Burak