Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Javascript object onClick reference another object's onclick

Posted on 2007-12-05
3
Medium Priority
?
1,698 Views
Last Modified: 2012-05-05
In Java script, when I click on an object, it calls a function. But I actually need to run the function of another object because it passes the 'this' property of the object (I believe it's a DIV if that matters. So, when I click on object A, can I call object B's event?

ObjectA onClick=(ObjectB(onmouseup="DoSomething(this)")

Can I do that? Or, how can I get the 'this' of objectB to objectA's event?

Thanks in advance
0
Comment
Question by:niner
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
raj3060 earned 500 total points
ID: 20412065
Yes you can call Object B event from Object A by using document.getElementById('ObjectBid')
0
 

Author Comment

by:niner
ID: 20412321
Cool bean. Then, how do I call the function?

0
 
LVL 11

Expert Comment

by:raj3060
ID: 20412420
DoSomething(document.getElementById('ObjectBid').value)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question