EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: pratikk on May 16, 2015, 04:06:01 AM



Title: How can I get the id of focused numberbox
Post by: pratikk 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"));
                });
});



Title: Re: How can I get the id of focused numberbox
Post by: jarry 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"));
    });
})


Title: Re: How can I get the id of focused numberbox
Post by: pratikk on May 17, 2015, 02:38:03 AM
Thank you. I spend a day to solve this :)