jQuery给input绑定回车事件
dataInput为Span元素ID
<script type="text/javascript" src="Scripts/jquery-1.6.2.js"></script>
<script language="javascript" type="text/javascript">
$(function(){
$('#dataInput').bind('keypress',function(event){
if(event.keyCode == "13")
{
alert('你输入的内容为:' + $('#dataInput').val());
}
});
});
</script>
<script language="javascript" type="text/javascript">
$(function(){
$('#dataInput').bind('keypress',function(event){
if(event.keyCode == "13")
{
alert('你输入的内容为:' + $('#dataInput').val());
}
});
});
</script>