javascript - Check if an HTML element with the same id exists -
can done using javascript?
if you're trying find out if more 1 element share 1 id, jquery $('[id=blah]').length
- return count of elements id equal 'blah'. see the fiddle. if it's greater 1 have duplicate id.
edit: i've tested in chrome, ff , ie6, , of them show there 2 elements same id. agree it's bad form have more 1 element share id, code work.
Comments
Post a Comment