【问题标题】:Why $("input:radio") is not working? [duplicate]为什么 $("input:radio") 不起作用? [复制]
【发布时间】:2014-10-06 17:16:32
【问题描述】:

我可以突出显示单选按钮!!为什么?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Document</title>
<script type="text/javascript" src="jquery-2.1.1.min.js"></script>
<script type="text/javascript">
$("document").ready(function() {
     $("input:radio").css('border','1px solid red');
});
</script>
<style type="text/css">
.a { color: Navy; }
.b { color: Maroon; }
</style>
</head>
<body>
<form>
<input type='radio' checked='checked'>Male
<input type='radio>Female
</form>
</body>

我在stackoverflow中看到很多这样的代码被人们使用

【问题讨论】:

  • 不要引用文档$(document) 而不是$("document")
  • ready 函数无关紧要。
  • 选择器很好....你要做的是问题
  • 我不这么认为,我们可以像这样为单选按钮应用边框

标签: jquery jquery-selectors radio-button


【解决方案1】:

用作

 $(document).ready(function() {

而不是

 $("document").ready(function() {

【讨论】:

    猜你喜欢
    • 2016-01-24
    • 2013-03-05
    • 2012-10-01
    • 2014-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多