Home Tutorial Jquery jQuery 'select' form event

 
 

jQuery 'select' form event
Posted on: August 3, 2010 at 12:00 AM
In this tutorial, we will discuss about 'select ' form event to display message when we select something inside input box.

jQuery 'select' form event

In this tutorial, we will discuss about 'select ' form event to display message when we select something inside input box. In this Example, two input text box are given , when we select something inside text box , it will display message "Some text was selected" . This is due to the "select" event .

selectFormEvent.html

<!DOCTYPE html>
<html>
<head>
<style>
p { color:blue; }
div { color:red; }
</style>
<script src="jquery-1.4.2.js"></script>
</head>
<body>
<p>

Click and drag the mouse to select text in the input box.
</p>
<input type="text" value="Select something" />
<input type="text" value="Select some text" />

<div></div>
<script>
$("input").select( function () {
$("div").text("Some text was selected").show().fadeOut(1000);
});
</script>
</body>
</html>

OUTPUT

When we select some text inside inputs :

Download Source Code

Click here to see demo

Related Tags for jQuery 'select' form event:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.