Skip to content
Advertisement

Tag: element

this.name returns undefined in javascript

I am trying to remotely create an onclick for each <div> (to save typing time). Here is the window.onload() function: The name of every <div> is “flyingsheep” – this value was set by <div name=”flyingsheep”>. When I click the <div>, the iframe “game” takes me to the webpage “/games/undefined”. Answer This will work. the problem is corrected. just use :

Get multiple elements by Id

I have a page with anchor tags throughout the body like this: The ID is always the same but the name changes. I need to populate a list of the names of these anchor tags, for example; Name 1, Name 2, Name 3. This is where I’ve got to so far: This writes out the name of the first anchor

How to set DOM element as first child?

I have an element E and I’m appending some elements to it. All of a sudden, I find out that the next element to append should be the first child of E. What’s the trick, how to do it? Method unshift doesn’t work because E is an object, not array. Long way would be to iterate through E’s children and

Advertisement