Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I get the source (sende)r element of a kendoui widget

Tags:

kendo-ui

How does one get the caller (sender) of the kendoui datepicker widget? Or any widget for that matter.

<input id="datepicker1" class="datepicker" value="10/10/2011" />

$(document).ready(function () {
    // ready
    $(".datepicker").kendoDatePicker({
        change: onchange
    });
});

function onchange(e) {
    $(this).hide();
}

Here is a fiddle: http://jsfiddle.net/bryanb/zz48F/

like image 971
Bryan Avatar asked Dec 27 '22 11:12

Bryan


1 Answers

The sender is available as this.element. It will be a jQuery object:

$(function () {
    function onchange(e) {
        alert(this.element.prop("id"));
    }

    $(".datepicker").kendoDatePicker({
        change: onchange
    });
});

http://jsfiddle.net/zz48F/3/

like image 150
Tomalak Avatar answered Apr 26 '23 09:04

Tomalak