Wednesday, September 28, 2011

JQuery Select Event

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:

Most Recent Post

Community Updates

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape