Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onClick Not Working 1

Status
Not open for further replies.

ToddWW

Programmer
Mar 25, 2001
1,073
0
0
US
Hi folks. Been searching google and forums for a while and unable to find this result. Here's a quick simple piece of code to explain.

Code:
<html>
<head>
<script>
  function myFunc() {
    alert('hello');
  }
  function ajaxCall() {
    //performing ajax call here and using innerHTML to place response in <div> below
  }
</script>
<body>
  <div id="textFromAjax"></div>
</body>
</html>

So my issue is this. In the ajax response I have a button with an onClick event trying to fire the myFunc function on the main page. I assume that the ajax response is not binding with the calling page. Any ideas here? Much thanks in advance.
 
Possibly because your "example" code does not have an "onclick() event defined anywhere.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Chris, thanks! Yes, I was trying to save some time because I was certain the issue had to do with binding the javascript being brought in and placed on the page with innerHTML. Had I posted the actual onClick() event in my code, you would have noticed a missing quotation mark.. Appreciate the response though. Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top