What happens when two elements share the same ID Tag #

Applying eValid to AJAX applications that require advanced DOM-based methods.

What happens when two elements share the same ID Tag #

Postby AmeliaE » Tue Nov 25, 2014 11:55 am

Morning:

What happens if two page elements have the SAME ID tag value.

Does eValid fall over in this case?
AmeliaE
 
Posts: 1
Joined: Tue Nov 25, 2014 11:44 am

Re: What happens when two elements share the same ID Tag #

Postby eValid » Fri Nov 28, 2014 9:47 am

AmeliaE wrote:Morning:

What happens if two page elements have the SAME ID tag value.

Does eValid fall over in this case?


Thanks for asking AmeliaE.

The browser doesn't care. No requirement for unique IDs exists.

In spite of that, it is bad form not to have ID's be unique.

Even so, non-unique IDs' happen a lot, e.g. when two part of the page have been copied from other pages and the assigned ID tags happen to coincide.

But if you search, you have to watch out. Because in eValid the IndexFind command finds the FIRST index including and after (higher) the current one. See the manual page:

http://www.e-valid.com/Products/Documen ... ement.html

If the what you really want to do is search for the second one, the way you do that is to run two searches laid out as follows:

IndexSet 0
IndexFindElement ..."Id"..."Value"
IndexMove +1
IndexFindElement ..."Id"..."Value"

This finds the second ID tag (if it exists) with the specified value.

Here is the manual page for all of the element manipulation commands:

http://www.e-valid.com/Products/Documen ... ement.html

-- eValid Support
eValid
 
Posts: 2392
Joined: Tue Jan 01, 2008 12:48 pm
Location: USA


Return to AJAX Applications & DOM Processing

Design Downloaded from free phpBB templates | free website templates | Free Web Buttons