Dojo:如何获取元素变量的元素

时间:2010-07-07 16:31:13

标签: javascript dojo

例如,理想情况下我想去:

newelement = myElement.query('whatever');

基本上mootools如何做到这一点:

element = oldemement.getElement('whatever');

dojo中的等价物是什么?如果它有所不同,我在拖放创建器功能中使用它:

function myCreator( item, hint ) {
    console.log(item);
    var a = dojo.query('.name', item)
    console.log(a);
   var myDiv = dojo.create( 'table', { innerHTML: item.name });
   if (hint == 'avatar') myDiv.innerHTML = 'Im an avator of ' + item.name;
   return {node: myDiv, data: item, type: item.type};
}
dojo.addOnLoad( function() {
    new dojo.dnd.Source("categoryTable", {creator: myCreator });
...

项目日志返回:

 <td><span class="dojoDndHandle">::</span></td>
<td><input type="hidden" name="category_8" value="0"><input type="checkbox" name="category_8" id="category_8" value="1"></td>
<td class="name"><a href="/news/admin/editCategory/8">Category A</a></td>
 <td><span title="18:57:11 04/07/2010">3 days ago</span><br>By <a href="/user/1/">Ashley</a></td>

1天前由Ashley

1 个答案:

答案 0 :(得分:1)

dojo.query('whatever', oldelement)

请参阅dojo.query()