B2C-无法在我的自定义策略中使用 JS 隐藏元素
B2C- Unable to hide element with JS in my custom policy
在我的自定义策略中,我尝试隐藏 email_intro 标签但没有成功:
- 这是我的 html 代码:
<div id="api" data-name="Unified">
<form id="attributeVerification">
<div id="attributeList" class="attr">
<ul>
...
<li class="TextBox">
<div class="attrEntry">
<div>
<div class="verificationInfoText" id="email_intro" style="display:
inline;" aria-hidden="false" aria-live="polite"
role="alert">Verification is necessary. Please click Send button.
</div>
...
</div>
</div>
</li>
...
</ul>
</div>
<div class="buttons">
...
</div>
</form>
</div>
-我的JS代码
var intro = document.getElementById("email_intro");
intro.style.setProperty('display','none');
请问有人知道错误是什么吗?
PS : 我对其他元素做了同样的事情并且有效!!
感谢 Nicolas and micahlt 的宝贵讨论。将您的讨论作为答案发布,以帮助其他社区成员。
This seems to be an issue occurred due to style sheet miss match.
Targeting the correct style sheet [element.style {display: inline; }
] to class name (.verificationInfoText
) solved the issue.
@micahlt 你是对的,我检查了页面,那是另一个注入的样式表 element.style {display: inline; }
谢谢。有效
在我的自定义策略中,我尝试隐藏 email_intro 标签但没有成功:
- 这是我的 html 代码:
<div id="api" data-name="Unified">
<form id="attributeVerification">
<div id="attributeList" class="attr">
<ul>
...
<li class="TextBox">
<div class="attrEntry">
<div>
<div class="verificationInfoText" id="email_intro" style="display:
inline;" aria-hidden="false" aria-live="polite"
role="alert">Verification is necessary. Please click Send button.
</div>
...
</div>
</div>
</li>
...
</ul>
</div>
<div class="buttons">
...
</div>
</form>
</div>
-我的JS代码
var intro = document.getElementById("email_intro");
intro.style.setProperty('display','none');
请问有人知道错误是什么吗?
PS : 我对其他元素做了同样的事情并且有效!!
感谢 Nicolas and micahlt 的宝贵讨论。将您的讨论作为答案发布,以帮助其他社区成员。
This seems to be an issue occurred due to style sheet miss match. Targeting the correct style sheet [
element.style {display: inline; }
] to class name (.verificationInfoText
) solved the issue.
@micahlt 你是对的,我检查了页面,那是另一个注入的样式表 element.style {display: inline; }
谢谢。有效