Jump to content

Recommended Posts

Posted

I need to fire the onclick event for a link but I have no way to identify the object.

<div id="button">
     <a href="" onclick="some_javascript_here">
          <img alt="Add Account" src="images/add_account_button_blue.jpg">
     </a>
</div>

As you can see, I can identify the parent element in the DOM (id="button") but I can't find a way to use that information to target the daughter <a> tag.

Any ideas?

Posted

Once you have a reference to the div, you should be able to do the following:

$oElement = _IETagNameGetCollection($oDiv, "A", 0)

Fantastic! Worked like a charm.

Jdelaney - Your solution worked as well and I like that it can be used in boader application although DanP2 solution was sufficiant for this specific issue. Thanks for showing me the childnodes code. Crawling the DOM that way will come in handy at some point!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...