Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.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
Javascript 一次只选择一个区域_Javascript_Jquery_Html_Maphilight - Fatal编程技术网

Javascript 一次只选择一个区域

Javascript 一次只选择一个区域,javascript,jquery,html,maphilight,Javascript,Jquery,Html,Maphilight,我有一个图像,我想选择区域的,但如果你点击一个区域,前一个区域需要“解锁” 只需从元素中删除选中的属性: $('.mappings').click(function (e) { $('.mapping').not(this).removeAttr('checked').prop('checked', false); e.preventDefault(); [...] }); 请描述一下您的意思未勾选?为什么你不能先为所有区域重置所有以前的更改,然后再将普

我有一个图像,我想选择区域的,但如果你点击一个区域,前一个区域需要“解锁”


只需从元素中删除
选中的
属性:

 $('.mappings').click(function (e) {
      $('.mapping').not(this).removeAttr('checked').prop('checked', false);
      e.preventDefault();
      [...]
 });

请描述一下您的意思
未勾选
?为什么你不能先为所有区域重置所有以前的更改,然后再将普通的内容重置为当前的更改?是的,我需要从区域中获取值,但一次只能获取一个值;同样的结果,我仍然可以选择多个区域。
 $('.mappings').click(function (e) {
      $('.mapping').not(this).removeAttr('checked').prop('checked', false);
      e.preventDefault();
      [...]
 });
$('.mapping').data('maphilight', { alwaysOn: false }).trigger('alwaysOn.maphilight');
$(this).data('maphilight', {alwaysOn: true}).trigger('alwaysOn.maphilight');