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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:37:51+00:00 2026-06-04T14:37:51+00:00

The following code gives me an alert with nothing but a # symbol inside

  • 0

The following code gives me an alert with nothing but a # symbol inside it. Why?

EDIT: I should note that the code is inside a jQuery .click event…if I place it outside of that, it works properly. Here is the fuller code:

 $('#continue').click(function(){
                                 var _href = $("#continue").attr("href");
                                 alert(_href);                                
            });


<a href="selectRadius.html" data-icon="arrow-r" id="continue" style="float:right;" data-role="button" data-inline="true">Continue</a>

EDIT2: This all works fine in jsfiddle. But in the xcode iphone simulator I just get #.

  • 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-04T14:37:53+00:00Added an answer on June 4, 2026 at 2:37 pm

    Judging by only the code you typed, probably the code runs too early. Try wrapping the JS in

    $(function() {
        // your code here
    });
    

    Or

    $(document).ready(function(){ 
        // your code here
    });
    

    Update:

    Well, since it’s an iPhone simulator, it changes things. Remember, nobody can help you unless you give all the details of the problem, no matter how much experience they have.

    Did you try the touchstart / touchend / tap events instead of click? As far as I know, Apple has been having problems with the click events. Also, click events on mobile devices will have a slower response (a delay of approx 300ms if I remember well) so you’re better just using touch specific events.

    What are you building? Is it a mobile web app or? Will it run in a standard mobile browser or something like PhoneGap etc?

    Update2:

    Ok. It works as long as the code is not called on Click. This eliminates the possibility of another piece of code replacing your “href” with another value because that code would have to be inside your $('#continue').click(function(){ }); block.

    The click event is simulated on a touch phone, that’s why the touch events are faster (they are native) and less likely to cause problems. You should also make sure that you return false there and not follow the link, that might be what’s replacing your “href”.

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

Sidebar

Related Questions

The following code inside the tags gives error: Object Expected. <!-- JQuery/AJAX--> <script type=text/javascript>
I have following asp.net code but it gives error when I change dropdown selected
the following code gives me an alert with the selected value on page load
I have the following code and it gives me the text but not the
I have the following code but the FB.login gives a FB is not defined
The following code gives a NullReferenceException since XPathSelectElement can't navigate through the XPath expression
I'm having problems the following code gives me no results. however if I uncomment
when i am analyze my project following code gives me leakage warning. is there
The following C++ code gives an error while compiling: #include<iostream> using namespace std; class
The following code in VS2008 gives me a variable is already defined warning: if

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.