我想在焦點時更改html中文本框的顏色。但是我的顏色沒有變化。爲什麼我的焦點()在jquery不工作?
的Html
<!DOCTYPE html>
<html>
<head>
<title>Make a new account</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="script.js" type="text/javascript" ></script>
</head>
<body>
<h2 align="center" class="Heading">Want an account</h2>
<h3 align="center" class="Heading">Enter your details</h3>
<div align="center">
<form name="Info_Form">
<table>
<tr>
<td class="TD">Your Name Pal :</td> <td><input type="text" name="Name"></td>
</tr>
<tr>
<td class="TD">Your Password :</td> <td><input type="password" name="pwd"></td>
</tr>
<tr>
<td align="right" ><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
</div>
</body>
</html>
我的js文件:
$(document).ready(function(){
$('h2').fadeOut(3000);
$(".TD").focus(function(){
$(this).css("background-color","blue");
});
});
我到底做錯了什麼?
如何ü可以專注2個元件在同一時間在窗體上?? – iJade
@iJay他試圖捕捉的焦點事件,不分配焦點;) – Archer
@Archer啊....我的壞....是一種倉促 – iJade