jQuery:
$(document).ready(function() {
$('.text').load(function() {
if (this.value == this.title) {
$('.text').addClass("highlight");
}
});
});
CSS:
.highlight
{
background: #FFA9B8;
border: 1px solid red;
}
HTML
<label for="first_name">first name: </label>
<input type = "text" name = "first_name" class = "text" value = "First..." title = "First..." />
<label for="last_name">last name: </label>
<input type = "text" name = "last_name" class = "text" value = "Last..." title = "Last..." />
私は基本的に、ページがロードされたときに2つの入力フィールドの背景にクラス「ハイライト」を追加したいと考えています...タイトルと値の両方が同じ場合のみ。
ありがとう - アート