Pages

19 Aug 2013

Get id of focussed control with Jquery, asp,net, html

get id of focussed control id use the jquery selector "addClass" and "removeClass" with jquery

$('#txtkeyboard').focus(function() {
$(this).addClass("focus");
$('#txtpassword').removeClass("focus");
});

$('#txtpassword').focus(function() {
$(this).addClass("focus");
$('#txtkeyboard').removeClass("focus");
});

get control id - use this code

var focused = $('.focus').attr("id");
alert(focused);

No comments:

Post a Comment