How do I test if an object has properties? As you see below, I am iterating through a list of ids, in order to get the value of each. However in some instances, not all id elements will be on the page.
What I am looking for is something like 'hasproperties()' so that I could say:
I am currently getting a js error if the getElementById('GG_'+id) is not on found on the page.Code:if (hasproperties( document.getElementById('GG_'+id))){ other code... }
Code:var ids = document.getElementById('ggids').value; var tmp = ids.split(','); for(i=0;i<tmp.length;i++){ var id = tmp[i]; var qty = document.getElementById('GG_'+id).value; other code... }



Reply With Quote


Bookmarks