【发布时间】:2016-07-22 10:20:42
【问题描述】:
我正在尝试将焦点设置到隐藏 div 元素内的锚元素,同时单击另一个锚链接。我尝试了几个选项,例如 .focus()、.focusin()。但没有任何效果。
我的代码:
<script>
$(document).ready(function(){
$("#clickShow").on('click', function(){
$("#showDescription").show();
$("#showDescription").find("a").focus();
});
});
</script>
<div>
<a href="#" id="clickShow">View Hidden Text</a>
</div>
<div id="showDescription" style="display:none;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap <a href="#">Link Text</a> into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
我想知道,我在这里缺少什么来完成它?
感谢您的宝贵帮助。
【问题讨论】:
标签: javascript jquery html focus show-hide