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 8843143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:08:43+00:00 2026-06-14T11:08:43+00:00

I can not return values bools / strings using the following convention. http://jsfiddle.net/eQWyY/ <input

  • 0

I can not return values bools / strings using the following convention.

http://jsfiddle.net/eQWyY/

<input id="lol" type="text" value="ahh" />

<script>
function test() {
    var flag = false;
    if ($('#lol').val()) {
        alert($('#lol').val()); //"sanity check - pass"
        flag = true;
    }
    return flag;
};

function modal() {};
var m = new modal();

modal.prototype.init = function(x) {
    this.input = x;
    this.modals = {};
    this.initModalFrames();
    this.executeLogic();
}

modal.prototype.initModalFrames = function() {
    for (i in this.input) {
        this.modals[i] = {
            handle :    this.input[i].handle,
            frame :     this.input[i].frame,
            logic :     this.input[i].logic ? this.input[i].logic : null
        };
    }
}

modal.prototype.executeLogic= function() {
    var s = this;
    $.each(this.modals, function(i, o) {
        if(s.modals[i].logic != null) {
            var x = s.modals[i].logic.call();
            if(x) {
                alert('true');
            }
            else {
                //Always evaluates to false
                alert('false');
            }
        }
    });
}

m.init([
      {handle: '#handle1', frame: '#frame2', logic: function() {test();}},
]);

</script>

The function does not seem to return anything and always evaluates to false.
What am I doing wrong here?

  • 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-14T11:08:45+00:00Added an answer on June 14, 2026 at 11:08 am

    Your logic handler should return the result of test execution:

    { handle: '#handle1', frame: '#frame2', logic: function() { return test(); } }
    

    or simpler:

    { handle: '#handle1', frame: '#frame2', logic: test }
    

    DEMO: http://jsfiddle.net/eQWyY/1/

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

Sidebar

Related Questions

I am using Datetime.Minvalue which return 1.1.0001. This value can not be stored to
As topic suggested, how can I unit test a function that does not return
Can a function in R return not one, but two vectors? (I am really
Why return type of a method is not considered in method overloading ? Can
I'm using following code but cannot return data from MySQL. This is the output:
Can some one explain to me why the GetProperties method would not return public
The following code has worked in v1.3 but not 1.4 I can't seem to
My matlab can't recognise the unix('who'); it returns as the 'who' is not an
I'am new in javascript. I can't understand why the function returns T1 object (not
I've been able to find lots of stuff about using the ASP .NET Membership

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.