In this article we will learn how JQuery select events work
The select event is sent to an element when the user makes a text selection inside it. This event is limited to <input type="text"> fields and <textarea> boxes.
Example 1: Show Alert when textbox value is selected using JQuery Select Event (Live Demo)
I have a html textarea control, whose id is "txtInput" on selecting content of textarea, I will display alert.
<textarea id="txtInput" rows="5" cols="20">Welcome to the world of JQuery</textarea>
JQuery script for showing alert on text content selection
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#txtInput").select(
function () {
alert("Text content is selected");
}
);
});
</script>
I will be discussing more JQuery examples in JQuery example series.
No comments:
Post a Comment