hi

i want to check off a checkbox while i'm typing. for an example if i'm typing "oranges are good" and i have oranges, apples, and blueberry under my check box. i want oranges to be checked of as soon as i type oranges in my phrase "oranges are good". i'm trying to do this using jquery. if you can help please reply

if keyup does not work, try keypress :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>hielo</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
	$('#description').bind('keyup',function(){
		var val=this.value;
		$('input[name=fruit]').each(function(){
				this.checked=val.indexOf(this.value)>-1;
		});
	});
});
</script>
	</head>
	<body>
	<div><input type="checkbox" name="fruit" value="orange"/>Oranges</div>
	<div><input type="checkbox" name="fruit" value="apple"/>Apple</div>
	<div><textarea name="description" id="description" rows="7" cols="50"></textarea></div>
	</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.