Text highlight plugin in jquery

<!–

Hey This is a simple plugin that highlight a your text what you type in the text field within the written text in span tag.

The plugin saved in highlight.js.You can rename it according to your wish.Collect the plugin form the below site.I also collect it from the below site…
http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html

–>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
<script type=”text/javascript” src=”jquery.js”></script>
<script type=”text/javascript” src=”highlight.js”></script>
<script type=”text/javascript”>

$(document).ready(function(){

$(‘#b’).click(function(){

var a = $(‘#a’).val();
$(‘body’).removeHighlight().highlight(a)
});
/*$(‘#a’).keydown(function(){

$(‘#spa’).removeHighlight();

});*/

});

</script>
<style type=”text/css”>

.highlight { background-color: yellow }
</style>
</head>

<body>
<input type=”text” id=”a” /><input type=”button” id=”b” value=”click here” /><br />

<span id=”spa”>Howdy, myself tanvir.I am studing at Darul Ihsan University completing by BSc.</span>
</body>
</html>

Advertisements