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? Link to comment https://forums.phpfreaks.com/topic/89392-solved-id-exists/ 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. Link to comment https://forums.phpfreaks.com/topic/89392-solved-id-exists/#findComment-457750 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.