Hello,
My IDE complains the usage of value like in the below YUI statement is deprecated.. it works, still, what is the proper usage.
var idValue= document.getElementById('id').value;
thanks.. Babu
Hello,
My IDE complains the usage of value like in the below YUI statement is deprecated.. it works, still, what is the proper usage.
var idValue= document.getElementById('id').value;
thanks.. Babu
That's a perfectly valid statement, not sure what your IDE is having a problem with here. Various libraries have shortcuts for this (syntax shortcuts, not performance shortcuts), but none of that prevents the core JavaScript functionality from working, it's 100% valid.
I guess it's expecting the YUI style:
var element = new YAHOO.util.Element('id');
var idValue = element.get('value');
...but either method works, use whichever you want. I would prefer the shorter core javascript syntax here.
Babu,
As noted, the original code snippet does not use any JS library -- it sounds like the IDE is badly configured. Nick's answer looks good for YUI 2. In the newer YUI 3 syntax, you might do this:
YUI().use("node", function(Y) { var value = Y.one("#id").get("value); });
-Eric