EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: fonzie on February 03, 2024, 01:12:47 AM



Title: keypress for multiple text editors
Post by: fonzie 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 ?


Title: Re: keypress for multiple text editors
Post by: fonzie 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