我的代码:
var panel2 = new Ext.Panel({
id: 'myPane1',
html: "<div style='width:100%;background-color:pink'>" +"<div style='width:49%;border:1px solid blue;float:left' >" + "<input type='text' value='second one' style='width:95%;'></input></div><div id='checkmy_Id' style='width:49%;border:1px solid black;float:left' >" + myVal + "</div></div>" ,
listeners: {
render: function (panel2) {
alert('panel render..');
//console.log(document.getElementById('checkmy_Id').innerHTML);
}
}
});
如何使用div
id
将值附加到checkmy_Id
。它给了我一个错误:innerHTML is null.
如何解决这个问题?
答案 0 :(得分:0)
尝试以下代码
render: function (panel2) {
//innerHTML
console.log(panel2.body.dom.innerHTML);
//To get HTMLElement
console.log(Ext.query("#checkmy_Id"));
}