我有一个表格。我包括道场。一切正常。我使用 Dojo 根据用户输入(类似于验证)更改输入元素的类、值和属性。
问题是,由于 IE,如果我想将输入的“类型”从“文本”更改为“密码”,我需要创建一个新的输入元素(我知道)。
一旦我创建了这个元素(它具有所有相同的属性和相同的 ID)作为它替换的元素,我的 Dojo 功能,例如......
dojo.query("#password2")
.connect("onclick",function(){
// if password2 is equal to the default text
if( this.value == "Confirm your password" ){
this.value = "";
UpdateType( this ); // this is the function that dynamically creates the new input element to have a type of 'password'
}
dojo.query("#list_password2").removeClass("error");
});
...不再适用于新创建的元素。我之前遇到过这个问题,并且曾经使用过 jQuery,并且有一个 livequery 插件,可以将事件重新分配给元素。Dojo 是否有我不知道的插件或本机功能来执行此操作?