Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery html/css:添加一个';关闭';按钮添加到我的div。单击_Jquery_Html_Css - Fatal编程技术网

jquery html/css:添加一个';关闭';按钮添加到我的div。单击

jquery html/css:添加一个';关闭';按钮添加到我的div。单击,jquery,html,css,Jquery,Html,Css,这里是jquery的新手,现在当选择一个单选按钮时,我有一个工作的隐藏/显示功能。然而,在我选择一个单选按钮后,没有办法取消选择所有选项并隐藏div。理想情况下,我想添加一个小的“X”,用户可以点击它来重置我的单选按钮和汽车数量,我想你们可能知道我的意思。非常感谢你的帮助 html HTML: <a class='close'>Close</a> 这是你想要的答案吗 <a href="" onclick="$('input:checked').removeAttr

这里是jquery的新手,现在当选择一个单选按钮时,我有一个工作的隐藏/显示功能。然而,在我选择一个单选按钮后,没有办法取消选择所有选项并隐藏div。理想情况下,我想添加一个小的“X”,用户可以点击它来重置我的单选按钮和汽车数量,我想你们可能知道我的意思。非常感谢你的帮助

html

HTML:

<a class='close'>Close</a>

这是你想要的答案吗

<a href="" onclick="$('input:checked').removeAttr('checked');
  $('.desc').hide();return false;">Reset</a>

<a class='close'>Close</a>
$('a.close').live('click', function(){
  $("input[name$='cars']").attr('checked', '');
  $("div.desc").hide();
});
<a href="" onclick="$('input:checked').removeAttr('checked');
  $('.desc').hide();return false;">Reset</a>