我刚刚开始使用dojo,并且我已经理解dojo.query
与jQuery中的$
相同。dojo.query()返回什么?
但我还没有弄清楚它返回的结果。它是像jQuery中的专门对象吗?
我想要做的(没有运气)是:
dojo.query("output").innerHTML = data;
//this doesn't work either:
dojo.query("output").html(data);
//tried accessing by id as well
dojo.query("#output").html(data);
//and tried to access a div, incase dojo has some issues with html5 elements
dojo.query("#divOutput").html(data);
而且我目前使用的新html5 elements:
<output id="output">Output goes here</output>
<div id="divOutput">non-html5 output goes here</div>
我似乎无法找到dojo.query()
返回的对象如何处理好的清单..
编辑:好吧,我认为道场现在只是在搞我。我发现这个方法:addContent()
,并在上述选择器上工作。但我不想添加内容,我想替换内容...
不,我使用HTML5元素'output',但只是为了确保我已经尝试给元素添加一个id,并且做同样的...仍然没有结果。 – peirix 2009-10-09 09:01:03
@peirix:我明白了。要使用输出元素,你应该设置它的值属性,而不是它的innerHTML属性。 – Guffa 2009-10-09 09:19:00
输出元素像div一样工作。它只是一个内容持有者,所以它没有价值属性。 http://www.w3schools.com/tags/html5_output.asp但我仍然无法使'html()'方法工作,即使在'div's ... – peirix 2009-10-09 09:42:32