2015-02-06 64 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")); 
}