Skip to content Skip to sidebar Skip to footer

Nextsibling Difference Between Ie And Ff?

I just wrote a javascript code for layering in raphaeljs it works perfectly on FF. But it doesn't on IE. The problem is IE returns null for nextSibling for any object. How does one

Solution 1:

Try to use the following function. It is a cross browser code snippet for next sibling.

functiongetNextElementSibling(CurrentElement) {
    if (CurrentElement.nextElementSibling) {
        returnCurrentElement.nextElementSibling
    } else {
        do {
            CurrentElement = CurrentElement.nextSibling;
        } while (CurrentElement && CurrentElement.nodeType !== 1);
        returnCurrentElement;
    }
}

Solution 2:

the nextElementSibling property is only supported in IE9 and not in previous versions of IE (you can check it here .

if you want you can get the next sibling using JQuery as follows:

var sibling = $('#' + selected_item_id).next();
alert(sibling.attr('id'));

Post a Comment for "Nextsibling Difference Between Ie And Ff?"