script function textFocus obj obj parent parent parent parent parent a

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<script>
function textFocus(obj){
$(obj).parent().parent().parent().parent().parent().addClass('focus');
}
function textBlur(obj){
$(obj).parent().parent().parent().parent().parent().removeClass('focus');
}
function clearText(obj){
$(obj).siblings('input').attr('value','');
$(obj).siblings('input').focus();
$(obj).hide();
}
function showIcoClear(obj){
$(obj).siblings('.ico-clear').show();
}
</script>
<!-- Text field -->
<div class="text-field">
<div class="br">
<div class="bl">
<div class="tr">
<div class="tl">
<input type="text" onblur="textBlur(this); if(this.value==''){this.value='Start typing...'}" onfocus="textFocus(this); if(this.value=='Start typing...'){this.value=''}" onkeypress="showIcoClear(this);" value="Start typing..." />
<a class="ico-clear" onclick="clearText(this);" href="javascript:;"><span class="offscreen">Очистить поле</span></a>
</div>
</div>
</div>
</div>
</div>
<!-- Text field -->
<div class="text-field search-field">
<div class="br">
<div class="bl">
<div class="tr">
<div class="tl">
<input type="text" onblur="textBlur(this); if(this.value==''){this.value='Start typing...'}" onfocus="textFocus(this); if(this.value=='Start typing...'){this.value=''}" onkeypress="showIcoClear(this);" value="Start typing..." />
<a class="ico-clear" onclick="clearText(this);" href="javascript:;"><span class="offscreen">Очистить поле</span></a>
</div>
</div>
</div>
</div>
</div>