$(document).ready( function() {
$('#date').bind("change",function(){
var x=$("#date").val();
alert(x);
});
});
对应的html代码:
<form id="form1">
<tr>
<td class="tr_tab"><a class="qtn_data">I am:</td><td class="tr_tab"> </a>
<input type="radio value="male" name="gender" /><a class="qtn_data">Male</a> 
<input type="radio" value="female" name="gender"/>
<a class="qtn_data">Female</a>
</td>
</tr>
<tr>
<td colspan="2">
<hr/ id="hr3">
</td>
</tr>
<tr>
<td class="tr_tab"><a class="qtn_data">Date of birth:</td><td class="tr_tab"> </a>
<input type="text" name="date" placeholder="Date" MaxLength="2" id="date" /> 
<input type="text" placeholder="Month" MaxLength="2" id="month" /> 
<input type="text" placeholder="Year" id="year" MaxLength="4" /> </td>
</tr>
<tr>
<td></td>
<td><span style="float:left;"><a class="qtn_data1">ex: 02/05/1992</a></span>
</td>
</tr>
<tr>
<td colspan="2">
<hr/ id="hr3">
</td>
</tr>
<tr>
<td><a class="qtn_data">I am from:</a>
</td>
<td>
<input type="text" id="place" placeholder="Town" />
</td>
</tr>
<tr>
<td></td>
<td>
<input type="text" id="place" placeholder="State" />
</td>
</tr>
<tr>
<td></td>
<td>
<input type="text" id="place" placeholder="Country" />
</td>
</tr>
</form>
更改文本框中的文本后Opera
,当我移动到另一个窗口时显示警报,但在..中没有效果Firefox
id="date"
Chrome