Share on Google+Share on Google+

jQuery 'select' form event

Advertisement
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

Advertisements

Advertisement

Posted on: August 3, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.