Jquery IE中光标位置错误
请在IE中尝试以下操作:Jquery IE中光标位置错误,jquery,html,internet-explorer,Jquery,Html,Internet Explorer,请在IE中尝试以下操作: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> &
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<style type="text/css">
* { font-family: Verdana; font-size: 96%; }
label { width: 10em; float: left; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
p { clear: both; }
.submit { margin-left: 12em; }
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
</style>
<script>
$(document).ready(function(){
$("#curl").focus(function(){
if( this.value == this.defaultValue ) {
$(this).val("http://");
}
});
$("#commentForm").validate();
});
</script>
</head>
<body>
<form class="cmxform" id="commentForm" method="get" action="">
<fieldset>
<legend>A simple comment form with submit validation and default messages</legend>
<p>
<input id="cname" name="name" size="25" class="required" value="Name" />
</p>
<p>
<input id="cemail" name="email" size="25" class="required email" value="Email" />
</p>
<p>
<input id="curl" name="url" size="25" class="url" value="URL" />
</p>
<p>
<textarea id="ccomment" name="comment" cols="22" class="required">Comment</textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
</body>
</html>
*{字体系列:Verdana;字体大小:96%;}
标签{宽度:10em;浮动:左;}
label.error{float:none;颜色:红色;左填充:.5em;垂直对齐:top;}
p{clear:两者;}
.提交{左边距:12em;}
em{font-weight:bold;padding-right:1em;垂直对齐:top;}
$(文档).ready(函数(){
$(“#curl”).focus(函数(){
if(this.value==this.defaultValue){
$(this.val)(“http://”);
}
});
$(“#commentForm”).validate();
});
带有提交验证和默认消息的简单注释表单
评论
如您所见,如果您关注URL字段,光标将返回到字段的开头。它在其他浏览器中工作没有问题。如何纠正呢
谢谢你的帮助 我想你也有同样的问题:
我认为您的问题与这里相同: