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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:00:53+00:00 2026-06-13T04:00:53+00:00

I have been researching and learning more and more about HTML 5, jQuery, CSS3,

  • 0

I have been researching and learning more and more about HTML 5, jQuery, CSS3, and the power of hiding and disabling certain elements when JavaScript is or is not disabled. (<noscript> tags)

My questions are,

  1. How do I make a hyperlink ONLY work if JavaScript is DISABLED?
  2. If JavaScript is enabled, how do I make sure that my drop-down login menu displays INSTEAD of following the hyperlink?

HTML

Simple enough, I hide my cart area and change the login link if the JS is disabled.

<!-- If JavaScript is disabled it will make the login link take you to a login page instead of a drop-down box. -->         
<noscript>
    <style>
        .login-form, .js-enabled{
            display: none;
        }
        .cart{
            top: -80px;
        }
    </style>                                
    <div class="cart">
        <a href="#" id="cart_img">
            <img src="img/bag.jpg" alt="Check Cart"
            onmouseover="this.src='img/bag-gold.jpg'"
            onmouseout="this.src='img/bag.jpg'">
        </a>
        <a href="#">Why HorseTack?</a> | 
        <a href="#">About</a> | 
        <a href="#">Contact</a> | 
        <a href="http://www.LOGINPAGELINK.com">Login</a>
    </div>
</noscript>
<!-- End JavaScript text -->

<div class="cart js-enabled">
    <a href="#" id="cart_img">
        <img src="img/bag.jpg" alt="Check Cart"
        onmouseover="this.src='img/bag-gold.jpg'"
        onmouseout="this.src='img/bag.jpg'">
    </a>
    <a href="#">Why HorseTack?</a> | 
    <a href="#">About</a> | 
    <a href="#">Contact</a> |                           
    <a href="#" class="login-box">Login</a>
        <div class="login-form">
            <form class="login-frm">
                <label><input type="text" placeholder="Username"></label>
                <label><input type="password" placeholder="Password"></label><br>
                <input type="submit" value="Login"><br>
                <a href="#">New User?</a>
            </form>
        </div>
</div>

JQuery

This makes the login-box slide down (just to avoid taking people to a login page unless they have to)

    // Login Box Pop-Up
jQuery(document).ready(function() {
    jQuery(".login-form").hide();
    //toggle the componenet with class msg_body
    jQuery(".login-box").click(function()
    {
    jQuery(this).next(".login-form").slideToggle(500);
    });
});

What I would like instead of having that <noscript> tag and the content duplicated, just a way for the hyperlink to only work when there is no JavaScript.

I have already set the page up to let users know when their JS is disabled (like Stack Overflow has done)

Any questions about my question (hopefully I wasn’t vague?) ask!

  • 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-13T04:00:54+00:00Added an answer on June 13, 2026 at 4:00 am

    How do I make a hyperlink ONLY work if JavaScript is DISABLED?
    If JavaScript is enabled, how do I make sure that my drop-down login menu displays INSTEAD of following the hyperlink?

    Write a JavaScript function that causes the menu to be displayed. Make sure that it captures the first argument (which will be the event object).

    Bind the function to the link as an event handler.

    Call preventDefault() on the event object.

    function (event) { /* display menu then ... */ event.preventDefault(); }
    

    <noscript> tags

    There are almost always the worst solution to a problem. Be progressive and unobtrusive.

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

Sidebar

Related Questions

I have been researching all over the internet about this, and unfortunately cannot find
I am a JavaScript learner and have been researching this matter, but with no
I have been researching about the headless browsers available till to date and found
I have been researching like mad while I learning C. I have been debugging
I have been researching the JQuery way to add table rows dynamically. One excellent
I have been researching for over an hour and finding great samples of how
I have been researching this issue pretty extensively and cannot seem to find an
I have been researching intently and have been unable to find a solution to
I have been researching OpenGL programming on Mac OS X. While a fair amount
I have been researching this for a while but got no convinced answer. From

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.