[jQuery] jQyery + netbeans visual jsp

[jQuery] jQyery + netbeans visual jsp


Hi!
I am new to jQuery and trying to use it with netbeans. Netbeans visual
jsf build html elements on the fly, so if I put a input box with
id="form1:nome" in the page, the code on the browser will be:
<span id="_form1:nome">
<script type="text/
javascript">webui.suntheme4_2.widget.common._createWidget
('_form1:nome',{
"valid": true,
"visible": true,
"autoValidate": false,
"autoComplete": false,
"label": {
"level": 2,
"value": "Nome:"
},
"size": 20,
"id": "form1:nome",
"readOnly": false,
"style": "left: 24px; top: 24px; position: absolute",
"widgetType": "webui.suntheme4_2.widget.textField",
"value": "Marcelo",
"required": false,
"disabled": false
});</script></span>
So I can not use $(document).ready(). The document is ready but the
control is build after DOM building....
Now if I make:
jQuery.noConflict();
var $j = jQuery;
window.onload = function() {
setTimeout("inicializa()",0);
}
function inicializa() {
$j("#form1\\:nome_field").click(function (e) {
alert($j("#form1\\:nome_field").val());
var message = "";
for (property in e) {
message = message + "Propriedade " + property + ": " + e
[property] + "\n";
}
$j("#form1\\:area_field").val(message);
});
};
Works fine!!
Is this correct (observation, only work if I use setTimeout)?
Thanks
Marcelo Módolo