Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have multiple textbox controls on my window. i want specific Id of specific control on which mouse get clicked.
Posted
Comments
stibee 23-Feb-15 4:42am    
Can you show some code?

Very easy. You can use the click Event.

See the Demo - [Demo] Get the Control where mouse is clicked[^].
 
Share this answer
 
Try jQuery focus method, e.g.
XML
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("input:text").focus(function(){
        alert($(this).attr('id'));
    });
});
</script>
</head>
<body>
<input type="text" id="textbox1" value="">
<input type="text" id="textbox2" value="">
</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900