Wednesday, December 25, 2013
Are you aware of .importance DOM while using .insertBefore in JS ?
In javascript .insertBefore is used to Insert every element in the set of matched elements before the target.
As same as .insertAfter function Insert every element in the set of matched elements after the target.
As in the following example I have used it for the moving selected items up/down in the list box. In each up/down arrow click I am triggering this function by passing html element as the newValue & index value to be move as the columnValue.
parameters (newValue = "<option> Test List Element</Option>", columnValue = 25)
It works correctly in Chrome & IE, but fails in Firfox. :(
Because in FF .insertBefore & .insertAfter expects both arguments to be DOM element references.
In the above example argument pass as string & integer, they are not treat as Document Object Mode.
So to overcome the above issue I have replaced the passing parameters as follows.
So to overcome the above issue I have replaced the passing parameters as follows.
I think this will be helpful for you to user .inserBefore or .insertAfter in js.
B' happiiiiiii :) always.
Refer : http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/136894/.insertbefore-not-working-in-ff
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment