“两个javascript参数如何传递”;这"; 按钮 函数openLayer(目标){ event.preventDefault(); var backFocus=$(“[aria controls='”+target+“]”); $(target).attr(“tabindex”,0).attr(“aria hidden”,false).show().focus(); $(文档).keyup(函数(e){ 如果(例如,keyCode==“27”){ console.log(backFocus);//[object对象] $(target).attr(“tabindex”,1).attr(“aria hidden”,true).hide().blur(); } }); }
我要目标通过这个 如何对焦返回“按钮”?“两个javascript参数如何传递”;这"; 按钮 函数openLayer(目标){ event.preventDefault(); var backFocus=$(“[aria controls='”+target+“]”); $(target).attr(“tabindex”,0).attr(“aria hidden”,false).show().focus(); $(文档).keyup(函数(e){ 如果(例如,keyCode==“27”){ console.log(backFocus);//[object对象] $(target).attr(“tabindex”,1).attr(“aria hidden”,true).hide().blur(); } }); },javascript,jquery,parameters,Javascript,Jquery,Parameters,我要目标通过这个 如何对焦返回“按钮”? 函数myFunction(myElement){ console.log(myElement.id); log(myElement.getAttribute(“a”); } 单击我显示更多上下文代码usage@kHRYSTAL,通过包含代码更新您的问题,请勿将其发布在评论中。抱歉。那是我的代码看看你指的是什么“这个”?谢谢^^:)我已经解决了 <button type="button" aria-haspopup="dialog" aria-con
函数myFunction(myElement){
console.log(myElement.id);
log(myElement.getAttribute(“a”);
}
单击我
显示更多上下文代码usage@kHRYSTAL,通过包含代码更新您的问题,请勿将其发布在评论中。抱歉。那是我的代码看看你指的是什么“这个”?谢谢^^:)我已经解决了
<button type="button" aria-haspopup="dialog" aria-controls="a" onclick="openLayer($('#a'))"> button</button>
<div role="dialog" id="a"><"button type="button">close<"/button></div>
function openLayer(target){
event.preventDefault();
var backFocus = $("[aria-controls='"+target+"']");
$(target).attr("tabindex", 0).attr("aria-hidden", false).show().focus();
$(document).keyup(function(e){
if (e.keyCode == "27"){
console.log(backFocus); // [obeject object]
$(target).attr("tabindex", 1).attr("aria-hidden", true).hide().blur();
}
});
}