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

  • SEARCH
  • Home
  • 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 4592672
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:34:24+00:00 2026-05-21T22:34:24+00:00

Goal: I’m trying to shorten how I call a function of the same namespace

  • 0

Goal: I’m trying to shorten how I call a function of the same namespace in a function by using “this” instead of the namespace string. But apparently “this” wouldn’t work for a function, it only works for a variable. I wish to know if it’s due to my misusage, or to call function with a namespace string is the only way.

Another beginner’s question: I’m calling a function of the same namespace as the caller’s. I googled and someone said by calling: this.myfunction would work, but it doesn’t. Any ideas? thanks.

I’m calling:
singleEntry.editContent.accept(tinyMCE.get(‘editContentTa’).getContent());

from:
index.fragment.singleEntry.editContent.load

I’ve tried to do it as: this.accept, but firebug says this.accept is not a function…

  index.fragment.singleEntry.editContent.load = (function(singleEntry) {
return function() {
    // prepare edit dialog
    $("#editContentDiv").dialog({
        autoOpen : false,
        height : 500,
        width : 600,
        modal : true,
        buttons : {
            "OK" : function() {
                singleEntry.editContent.accept(tinyMCE.get('editContentTa').getContent());
                $(this).dialog("close");
            },
            "CANCEL" : function() {
                $(this).dialog("close");
            }
        },
        open : function() {
            // set value to the edit area
            tinyMCE.get("editContentTa").setContent($("#veContent").html());
        }
    });
  • 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-05-21T22:34:25+00:00Added an answer on May 21, 2026 at 10:34 pm

    I’m not quite following your ultimate goal, so some theory in hopes it helps you get there:

    When you call a function via an object’s property (so, via dotted notation, or [] notation), this within the function call will be the object reference. So when you call

    singleEntry.editContent.accept(tinyMCE.get('editContentTa').getContent());
    

    …within that call, this will refer to singleEntry.editContent.

    If you want this to refer to something else, you can use call:

    singleEntry.editContent.accept.call(thisObj, tinyMCE.get('editContentTa').getContent());
    //                            ^^^^^^^^^^^^^
    

    …where thisObj is whatever object you want the function to see as this during the call. More here: Mythical methods

    call is a property of all (real) JavaScript functions, and is provide specifically to make it easy to call the function and set what this should be (what the context is) during the call. There’s also apply, which does exactly the same thing but accepts the arguments to pass to the function as an array rather that as discrete arguments. E.g., these two calls are identical:

    // Using `call`
    singleEntry.editContent.accept.call(thisObj, tinyMCE.get('editContentTa').getContent());
    
    // Using `apply`
    singleEntry.editContent.accept.call(thisObj, [tinyMCE.get('editContentTa').getContent()]);
    //                        Note the `[]` -----^
    

    All of this is made possible because in JavaScript, this is determined entirely by how a function is called, not where it’s defined — I think you know that, based on your question, but worth flagging up anyway.

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

Sidebar

Related Questions

Goal: implement unfold function using only two arguments. The arguments: the first argument is
Goal: To render a google map using geolocation. I am trying to implement the
GOAL: I'm trying to apply a Like button to my blog - this is
goal: I have the string 1234432144 I want to only replace the first 2
Goal : Our application is built using multiple types (e.g. Person, PersonSite(ICollection), Site -
goal : I want to place a text after the submit button using hook_form_alter.
Goal: I'm trying to refresh content inside a div so that if the user
Goal: Provide a web service using Visual Basic or C# or .NET that interacts
Goal: Parse a string from an input type text into TIME type to be
Goal: I am trying to create a slightly dynamic page animated with basic canvas

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.