[javascript] Check existance of value
Hi,
I have an object el which was taken from getElementById. I need to make sure that it has the proper object, so I need to check whether or not the value property exists on the object el. I tried if(!el.value) that just makes it check for a blank value not a non-existant value. I also tried if(typeof (t_el) ==undefined) but it won't work either because it seems that getElementById always gives me an object, whether or not it was really found. How can I check the existance of the property value on the object el? Secondly, is there a function I can use to dump a object or array to a string? Thanks, David |
okk, I found hasAttribute on w3.org.
but it doesn't work: Error: t_el has no properties Source File: http://server.tld/path/to/script.ext Line: 28 Is there a function that can check an object for properties maybe? |
I remember reading that somewhere in the object model, the entire list of elements in the form is returned as an array. So a solution might be to scan the array to check whether what you want is available.
end |
All times are GMT -5. The time now is 12:17 PM. |