Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8868791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:20:39+00:00 2026-06-14T17:20:39+00:00

Please see this fiddle: http://jsfiddle.net/GSHsH/9/ HTML: <div id=papa onclick=anything(this);>Blabla</div>​ JS: function anything(theObj){ window.alert(theObj.innerHTML); }

  • 0

Please see this fiddle:

http://jsfiddle.net/GSHsH/9/

HTML:

<div id="papa" onclick="anything(this);">Blabla</div>​

JS:

function anything(theObj){
    window.alert(theObj.innerHTML);
}

I do not understand why the function “anything” gets as not reconized. (using prototype)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:20:41+00:00Added an answer on June 14, 2026 at 5:20 pm

    It is not that it doesnt recognide this – it does not recognise the method anything because of a setting you’ve made in jsfiddle – to scope the javascript into onLoad. If you would have chosen no wrap (head) it would work fine: http://jsfiddle.net/GSHsH/11/

    A bit more detail. The way you set it up, this is what gets injected into the output frame in jsfiddle:

    Event.observe(window, "load", function(){
    
    function anything(theObj){
        window.alert(theObj.innerHTML);
    }
    
    });
    

    Note that the method anything is not in global (window) scope, it is in the scope of a particular function. This means its not visible to the element on the page.

    The way I set it up you get this:

    function anything(theObj){
        window.alert(theObj.innerHTML);
    }
    

    Which is just a plain old function defined in the head of the page – now accesible from an element on the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please consider this code here, also given is this fiddle: http://jsfiddle.net/DPNc6/ HTML: <div style=width:500px
Please see this simple fiddle http://jsfiddle.net/75qSD/ I want it to decorate the element as
Please take a look at this fiddle: http://jsfiddle.net/hughbe/QYGcq/ As you can see, the label
Please see this fiddle: http://jsfiddle.net/ZWw3Z/5/ My code is: p { position: relative; background-color: blue;
Please see this fiddle and click decrease: http://jsfiddle.net/2C8fy/16/ As you can see the images
Please observe this fiddle: http://jsfiddle.net/8nrPm/3/ I have set the width of the Animation button
Possible Duplicate: .prop() vs .attr() Please take a look at this fiddle: http://jsfiddle.net/DGzvP/ $(#test).prop({
please take a look at this fiddle : http://jsfiddle.net/cX47v/1 I am simply trying to
Please look at the fiddle below: http://jsfiddle.net/ujdsu/ HTML, simple unordered list: <ul class=sortable> <li>first
Please see this http://jsfiddle.net/yv8uw/1/ When you click View all Comments the box opens up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.