我有一个手风琴,我正在尝试为屏幕阅读器的人添加标题属性。我正在使用jQuery Mobile,并不确定它是否干扰了。问题是它不起作用。这是脚本:
$(function () {
$("#accordionContent h3 a").each(function () {
if ($(this).prop("class") == "accordionLink on") {
$(this).prop("title", $(this).text() + ", Submenu Open");
$(this).next().show();
} else {
$(this).prop("title", $(this).text() + ", Submenu Closed");
$(this).next().hide();
}
});
});
这是HTML:
<div data-role="content">
<div id="accordianContent" data-role="collapsible-set">
<div data-role="collapsible">
<h3><a href="#" title="" style="text-decoration:none;">JSON Tutorial</a></h3>
<p>Getting started with JSON</p>
</div>
<div data-role="collapsible">
<h3><a href="#" title="" style="text-decoration:none;">WordPress Newbie Tips</a></h3>
<p>Tips for the beginning WordPress user</p>
</div>
<div data-role="collapsible">
<h3><a href="#" title="" style="text-decoration:none;">Domain name tips</a></h3>
<p>Tips for getting a good domain name</p>
</div>
<div data-role="collapsible">
<h3><a href="#" title="" style="text-decoration:none;">Subdomain Advantages</a></h3>
<p>How and why to using a subdomain</p>
</div>
</div>
</div>