[英]javascrpit not working with aria-label show empty
Before Click Button点击按钮前
<button type="button" class="plyr__control" data-plyr="play" aria-label="Play">
After Click Button点击按钮后
<button type="button" class="plyr__control plyr__control--pressed" data-plyr="play" aria-label="Pause">
My Script我的脚本
<script> const $featured = $('.plyr__control'); // bind a change event handler to the input $featured.on('change', function() { if (button.getAttribute('aria-label') === 'Pause') { console.log('ok'); } }); </script>
Here JavaScript is not working. JavaScript 在这里不起作用。 How to solve this?如何解决这个问题?
Written by ( Carlos Moore ) and the rich skills Staff.由 ( Carlos Moore ) 和技能丰富的员工撰写。
aria-label咏叹调标签
An interactive element's label is defined by the string value of the aria-label property.交互式元素的标签由 aria-label 属性的字符串值定义。
There may be no visible content in the DOM that can be associated with the object to give it meaning when the element's default accessible name is absent or inaccurately describes its contents.当元素的默认可访问名称不存在或不准确地描述其内容时,DOM 中可能没有可以与对象关联的可见内容以赋予其意义。 A typical illustration is a button with no text and an SVG or icon font (which you shouldn't be using).一个典型的插图是一个没有文本的按钮和一个 SVG 或图标字体(你不应该使用)。
The aria-label attribute can be used to define a string that labels the interactive element on which it is set when an interactive element lacks an accessible name or has an inaccurate accessible name and no visible content in the DOM that can be linked via the aria-labelledby attribute. aria-label 属性可用于定义一个字符串,当交互元素缺少可访问名称或具有不准确的可访问名称且 DOM 中没有可通过 aria 链接的可见内容时,该字符串标记设置它的交互元素-labelledby 属性。 This provides the element with its accessible name.这为元素提供了可访问的名称。
<button aria-label="Close" onclick="myDialog.close()">
<svg aria-hidden="true" focusable="false" width="20" height="20" xmlns="http://www.w3.org/2000/svg"><path d="m.967 14.217 5.8-5.906-5.765-5.89L3.094.26l5.783 5.888L14.66.26l2.092 2.162-5.766 5.889 5.801 5.906-2.092 2.162-5.818-5.924-5.818 5.924-2.092-2.162Z" fill="#000"/></svg</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.