EasyUI Forum
May 16, 2024, 09:44:08 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Searchbox keyDown  (Read 5919 times)
sky-t
Full Member
***
Posts: 145


View Profile
« on: October 05, 2016, 05:34:52 AM »

Hi guys,

is there a possibility to get keyDowns in searchboxes?
I want the user if he pressing Enter to Search and if he is pressing CTRL+Enter to start a javascript function.


Thank you very much
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: October 06, 2016, 04:55:26 AM »

Call 'textbox' method to get the inputing box and you will be able to bind any events on it.
Code:
var tb = $('#sb').searchbox('textbox');
tb.bind('keydown', function(e){
  //...
});
Logged
sky-t
Full Member
***
Posts: 145


View Profile
« Reply #2 on: October 07, 2016, 11:14:38 PM »

Hi jarry,

thank you for your reply. When i don't use the searchbox searcher-function it works, but then the function of the search icon also doesn't work whats normal.
Can i trigger the search icon directly?

Thanks again


Thorsten

Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: October 08, 2016, 07:36:55 AM »

You can call 'getIcon' method to get the searching icon and then trigger its 'click' event.
Code:
var icon = $('#sb').searchbox('getIcon',0);
icon.trigger('click');
Logged
sky-t
Full Member
***
Posts: 145


View Profile
« Reply #4 on: October 08, 2016, 08:04:31 AM »

Hi jarry,

this works great!!

Thanks a lot!!!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!