Select all input elements with type=”checkbox”
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="lib/jquery/jquery-1.3.2.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$(":checkbox").wrap("<span
style='background-color:red' />");
});
</script>
</head>
<body>
<form action="">
Name: <input type="text" name="user" /><br/>
I have a bike:<input type="checkbox" name="vehicle"
value="Bike" /><br/>
I have a car:<input type="checkbox" name="vehicle"
value="Car" /><br/>
I have an airplane:<input type="checkbox" name="vehicle"
value="Airplane" /><br/>
<input type="submit">
</form>
</body>
</html>
Comments
Post a Comment