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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:55:02+00:00 2026-06-01T20:55:02+00:00

I started to create a todo list with jQuery mobile in order to learn

  • 0

I started to create a todo list with jQuery mobile in order to learn it better. I’m listening to the events coming from the buttons of a menu like this:

        me.selectedTarget = me.menuNode.find(".ui-btn").first();

        me.menuNode.on("click", ".ui-btn", function (e) {
            var target =  $(e.currentTarget)
                ,targetText = target.text();
            console.debug("Click on'", targetText,"'" );
            if(target === me.selectedTarget) return;

            if(targetText == "View To Do "){
                core.pub("view:todo");
            } else if(targetText == "View Done ") {
                core.pub("view:done");
            } else {
                me.selectedTarget.click();
            }
            me.selectedTarget = target;
        });

The variable targetText has one extra ” ” space at the end for some reason. I have 3 buttons, but the third one is a bit special – not relevant anyway -.

the buttons that this code listens to.

My problem is that I’m always getting on the last else clause. targetText never get’s to be equal to “View To Do ” or “View Done “.

Why isn’t “View Done ” == “View Done “? ~X(

firebug debugging results

the html markup

  • 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-01T20:55:04+00:00Added an answer on June 1, 2026 at 8:55 pm

    The comparison is failing because the strings are not the same. So the question really is why are they not the same? Apparently the space in one of the strings is not the standard space character (Unicode has more than one space), or one of the strings has an invisible character in it (Unicode has those, too).

    So to find out what’s going on, I’d do this:

    for (let index = 0; index < targetText.length; ++index) {
        console.log(`char at ${index}: ${targetText.charCodeAt(index)}`);
    }
    

    …and the same with your string literal in your code (not retyping it, but moving it into a local and then outputting that; since if you retype it, you’ll presumably type the normal space). Compare the sequences of character codes and you’ll find the discrepancy.

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

Sidebar

Related Questions

I wanted to create jquery plugin & started off creating a sample jquery plugin...But
Hi I started programming a ToDo-List on android (in eclipse) which synchronises with Google
I started to do some experimentation with iisnode and expressjs to create a REST
I'm new to ruby and started to create my *nd toy app. I: Created
So, I've started to create some Ruby unit tests that use Selenium RC to
thanks in advance for the replies.... I have started to create a network topology
I started a grails application by grails create-app. For modularity, I feel like it
I want to create a keyboard and mouse hook which will be started as
I'm writing an application that manages todo lists. Unlike 'traditional' todo list applications I
I've started to create a website where it's users are effectively tracked (they know

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.