[英]How can I add an attribute with special character using DOJO
Getting an error trying to add an attribute aria-live, because of the special character in between. 由于介于两者之间的特殊字符,尝试添加属性aria-live时出错。
How can I fix this? 我怎样才能解决这个问题?
dojo.ready(function(){
dojo.connect(dojo.query("#buttonTest")[0],"onclick",function(evt){
var fnameBox = dojo.byId("UPDATE_First_name_id").value;
var lnameBox = dojo.byId("UPDATE_Last_name_id").value;
if(fnameBox == ""){
if(!dojo.byId("error_fname")){
var xys1 =dojo.create("a",{title:"Error link", id:"error_fname", href: "#", class:"ibm-error-link", innerHTML:" "});
dojo.query("#UPDATE_First_name_id").after(xys1);
var span1=dojo.create("span",{class:"ibm-access", aria-live:"assertive", role:"alert"});
dojo.query("#error_fname").after(span1);
}
}
else{
dojo.destroy("error_fname");
}
Thanks for help in advance. 预先感谢您的帮助。
Zeeshan Zeeshan
Put the property names inside quotes. 将属性名称放在引号中。 You will also need to do this with the
class
property, because class is a reserved word. 您还需要使用
class
属性来执行此操作,因为class是保留字。
var xys1 =dojo.create("a", {
title:"Error link",
id:"error_fname",
href: "#",
"class": "ibm-error-link",
innerHTML:" "
});
var span1=dojo.create("span",{
"class":"ibm-access",
"aria-live":"assertive",
role:"alert"
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.