my code stock.com

Snippet options

Download: Download snippet as jquerymodify.html.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>jQuery.modify</title>
	</head>
	<body>
		<h1>jQuery.modify</h1>
		<form action="#">
			<div>
				<input type="text" name="text" autofocus="autofocus" value="jQuery modify test" />
			</div>
			<div>
				<input type="password" name="password" value="jQuery modify test" />
			</div>
			<div>
				<textarea name="textarea">jQuery modify test</textarea>
			</div>
			<div>
				<select name="select">
					<option value="jQuery">jQuery</option>
					<option value="modify">modify</option>
					<option value="test">test</option>
				</select>
			</div>
		</form>

		<!-- log area -->
		<div id="log"></div>

		<script src="https://code.jquery.com/jquery-1.7.0.min.js"></script>

		<!-- That's it! Now you can trap "modify" event! -->
		<script src="./jquery.modify.js"></script>
		<script>
(function($, window, undefined)
{
	$(function($)
	{
		$(window.document).on("modify", ":input", function(event, data)
		{
			// Look!
			var message = $(this).attr("name") + ": " + data.previousValue + " -> " + data.currentValue;
			$("<div />").text(message).prependTo($("#log"));
		});
	});
})(jQuery, window);
		</script>
	</body>
</html>

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.