我有5個文本字段的值取決於它的先行者(彼此)。如何刪除相關的文本字段在這種情況下輸入
說
T1,T2,T3,T4,T5
我requiremnt是說,如果文本字段的一個是空的,然後我要我做的所有successdors空。
如果T2是由空,則使T3,T4,T5空
同樣
如果T3是由空,則使T4,T5空
如果T4使空T5空
<div data-role="fieldcontain">
<label for="name">T1 Category:</label>
<input type="text" name="name" id="t1cat" value="" onkeypress="return nospecialCharacters(event)" placeholder="T1" autocomplete="off" /></br>
<label for="name">T2 Category:</label>
<input type="text" name="name" id="t2cat" value="" onkeypress="return nospecialCharactersforT2(event)" placeholder="T2" autocomplete="off" /></br>
<label for="name">T3 Category:</label>
<input type="text" name="name" id="t3cat" value="" onkeypress="return nospecialCharactersforT3(event)" placeholder="T3" autocomplete="off" /></br>
<label for="name">T4 Category:</label>
<input type="text" name="name" id="t4cat" value="" onkeypress="return nospecialCharactersforT4(event)" placeholder="T4" autocomplete="off" /></br>
<label for="name">T5 Category:</label>
<input type="text" name="name" id="t5cat" value="" onkeypress="return nospecialCharactersforT5(event)" placeholder="T5" autocomplete="off" /></br>
<input type="button" class= "btn blue" value="Request For This Category" id="requestcatbtn"/>
</div>
function nospecialCharacters(e) {
if (e.which == 38 || e.which==64)
return false;
}
function nospecialCharactersforT2(e) {
var T1 = $('#t1cat').val();
if (e.which == 38 || e.which==64 || T1=='')
return false;
}
function nospecialCharactersforT3(e) {
var T2 = $('#t2cat').val();
if (e.which == 38 || e.which==64 || T2=='')
return false;
}
function nospecialCharactersforT4(e) {
var T3 = $('#t3cat').val();
if (e.which == 38 || e.which==64 || T3=='')
return false;
}
function nospecialCharactersforT5(e) {
var T4 = $('#t4cat').val();
if (e.which == 38 || e.which==64 || T4=='')
return false;
}
http://jsfiddle.net/5odssxkq/2/
非常感謝你,這是非常好的工作。 – Pawan 2014-11-06 08:50:43