EasyUI Forum
May 02, 2024, 02:38:32 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: keypress for multiple text editors  (Read 632 times)
fonzie
Newbie
*
Posts: 9


View Profile
« on: February 03, 2024, 01:12:47 AM »

I have  text editors on different tabs and detect a keypress for autosave like this (simplified for easy reading)

$(function(){
    $('#texteditor1').on('keyup',function(e){
       

        console.log(e.keyCode)

    })
})

Rather than have five functions to check each editor, I would like to have one function to check a keypress and take action depending on what tab was selected, is this possible ?
Logged
fonzie
Newbie
*
Posts: 9


View Profile
« Reply #1 on: February 03, 2024, 04:50:54 AM »

OK, I solved this myself, code below for anyone that runs into a similar issue (probably for most controls).


$(function(){

$('.easyui-texteditor').on('keyup',function(e){
    var idname = $(this).attr('id');
    console.log(idname);
    console.log(e.keyCode)
  });

})

Hope this helps someone
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!