2015-02-06 62 views
0

我的代码:如何访问HTML元素的Ext JS面板

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); 
     } 
    } 
}); 

如何与checkmy_Idid值追加到div。它给我一个错误:innerHTML is null. 如何解决这个问题?

回答

0

试试下面的代码

render: function (panel2) { 
     //innerHTML 
     console.log(panel2.body.dom.innerHTML); 
     //To get HTMLElement 
     console.log(Ext.query("#checkmy_Id")); 
}