The Little Guy Posted February 4, 2008 Share Posted February 4, 2008 How can I check to see if an id exists? I have tried these: if(document.getElementById('profileID').exists()){ if(document.getElementById('profileID') != null){ neither of them work anyone know of a way? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 4, 2008 Share Posted February 4, 2008 if(document.getElementById('test') != null) should work fine assuming you are talking about testing for an HTML elements ID attribute and are executing the JavaScript after the page is done loading. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.