jQuery 'select' form event


 

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 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

Ads