I think you may want more than that. But here's what it looks like you're asking for:
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($){
$('.changer').bind('click change', function(e){
if(e.type === 'change' && e.target.value !== 'dred' || e.type === 'click' && /select|option/i.test(e.target.tagName)){return;}
$('.changee').css({border: '2px dashed red'});
if(e.type === 'click'){e.preventDefault();}
});
});
</script>
</head>
<body>
<div class="changee" style="border:1px solid black;">Hi</div>
<div class="changee" style="border:1px solid black;">There</div>
<div class="changee" style="border:1px solid black;">Folks</div>
<img src="some.gif" class="changer" alt="original image" title=""><br>
<select class="changer" name="whatever">
<option value="">Select</option>
<option value="dred">Change</option>
</select>
</body>
</html>
I think you may want more like so:
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($){
$('.changer').bind('click change', function(e){
var o = e.target.options, s = e.target.selectedIndex;
if(e.type === 'change' && o[s].text !== 'Change' || e.type === 'click' && /select|option/i.test(e.target.tagName)){return;}
$('.changee').toggleClass('dred');
if(e.type === 'click'){e.preventDefault();}
});
});
</script>
<style type="text/css">
.changee {
border: 1px solid black;
}
.changee.dred {
border: 2px dashed red;
}
</style>
</head>
<body>
<div class="changee">Hi</div>
<div class="changee">There</div>
<div class="changee">Folks</div>
<img src="some.gif" class="changer" alt="original image" title=""><br>
<select class="changer" name="whatever">
<option value="">Select</option>
<option value="">Change</option>
</select>
</body>
</html>
Bookmarks