EasyUI Forum
May 16, 2024, 10:12:55 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: How can I get the id of focused numberbox  (Read 5539 times)
pratikk
Newbie
*
Posts: 49


View Profile Email
« on: May 16, 2015, 04:06:01 AM »

I want to get the id of focused numberbox or combogrid or any easyui component

The code below is not working


        $(document).ready(
            function() {

                $("input").on("focus", function() {
                    alert($(this).attr("id"));
                });
});

« Last Edit: May 16, 2015, 08:13:32 AM by pratikk » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: May 16, 2015, 04:43:23 PM »

Please use the code below instead.
Code:
$(function(){
    $("input").on("focus", function() {
        if ($(this).hasClass('textbox-text')){
            var t = $(this).closest('.textbox').prev();
        } else {
            var t = $(this);
        }
        console.log(t.attr("id"));
    });
})
Logged
pratikk
Newbie
*
Posts: 49


View Profile Email
« Reply #2 on: May 17, 2015, 02:38:03 AM »

Thank you. I spend a day to solve this Smiley
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!