I use ext to creat my html in a panel,then I want to control it with jquery

first I write the code in my <script>,
Code:
Ext.onReady(function(){
varleftNavHtml = '<body><div id="sidebar">';					leftNavHtml += '<div class="trees">'
						leftNavHtml += '<div class="tree">'
leftNavHtml += '<div class="name">'
...
then, I use jquery

Code:
$("#sidebar .trees .name").toggle(function(){...
but the console message is $("#sidebar .trees .name") is null

can anyone help me?