我正在使用 Dojo Toolkit 中的“Highlight Container”效果(如图所示)。
当我有一个包含TEXTAREA而不是文本字段的DIV时,我的问题就来了。我不确定如何让它识别文本字段或文本区域。代码功能如下:
dojo.addOnLoad(function() {
dojo.query(".container input[type=text]",
dojo.byId("topLevel"))
.onfocus(function(evt){
//Make the background light yellow when an input gets focus
dojo.anim(getContainer(evt.target),{backgroundColor: "#FFFFCC"});
})
.onblur(function(evt){
//Restore the background when an input loses focus
dojo.anim(getContainer(evt.target), {backgroundColor: "#FFFF66"});
})
});
如您所见,这是找到文本字段的第二行。我想寻找 textarea 也会去那里,但我不知道语法。
谢谢您的帮助!