【问题标题】:Trying to adapt the Dojo Toolkit "Highlight Container"尝试改编 Dojo 工具包“Highlight Container”
【发布时间】:2009-09-05 17:38:32
【问题描述】:

我正在使用 Dojo Toolkit 中的“突出显示容器”效果(如 shown here)。

当我有一个包含 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 也会去那里,但我不知道语法。

感谢您的帮助!

【问题讨论】:

    标签: dojo containers highlight


    【解决方案1】:

    复合查询使用逗号:

    dojo.query("input[type=text], textarea", ...
    

    【讨论】:

    • 大卫,当一个答案解决了你的问题时,记得接受它(使用数字下方的复选标记图标为答案投票):这是基本的礼仪!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-07
    • 1970-01-01
    • 2011-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多