Skip to main content

How to make dropdown menu button also a button for a link?

This is my html code and I cant figure out how to get the button to be a link. Despite adding the anchor tag with a link inside, when I click on the button, nothing happens.

<!DOCTYPE html>

<html lang="en">
    <head>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
        <link href="styles.css" rel="stylesheet">
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Week 8 Homepage</title>
        <script src="homepage.js"></script>
    </head>
    <body>
        <div class="top flex">
          <span><a href="index.html" style="text-decoration: none"><h1 class="icon">Ron's Clothes</h1></a></span>

          <span>
            <div class="dropdown link1">
              <a href="link1.html" style="text-decoration: none;">
                <button class="btn btn-secondary btn-clr dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                  Shop
                </button>
              </a>
              <ul class="dropdown-menu">
                <li><a class="dropdown-item" href="link1.html">Tops</a></li>
                <li><a class="dropdown-item" href="link1.html">Pants</a></li>
                <li><a class="dropdown-item" href="link1.html">Outerwear</a></li>
              </ul>
              <a href="link1.html" style="text-decoration: none;"></a>
            </div>
          </span>

        </div>

        <img class="image" src="Screenshot (27).png" alt="clothes image">

        <h1 class="featured">Featured Items</h1>

        <div class="featuredimg">
            <div class="column position1">
              <a href="link1.html" style="text-decoration: none;">
                <img src="shirt1.jpeg" alt="featured1" style="width: 75%">
                <p>Early 90s Brine for Major Soccer<br>League Tee<br><strong>$38.58</strong></p>
              </a>
            </div>
            <div class="column position2">
              <img src="shirt2.jpeg" alt="featured2" style="width: 75%">
              <p>90s Nike 'There Is No Finish Line'<br>Windbreaker<br><strong>$75.32</strong></p>
            </div>
            <div class="column position3">
              <img src="shirt3.jpeg" alt="featured3" style="width: 75%">
              <p>1992/1993 Manchester United F.C.<br>Training Tee<br><strong>$68.64</strong></p>
            </div>
            <div class="column position4">
              <img src="shirt4.jpeg" alt="featured4" style="width: 75%">
              <p>1995 Houston Rockets x Looney Tunes<br>'Daffy Duck' Tee<br><strong>$43.93</strong></p>
            </div>
          </div>
    </body>
</html>

I tried shifting the anchor tag around and it doesn't work, sometimes the dropdown menu stops working too. I tried using javascript, giving the button and id and adding event listener but that doesn't work either. I need some help on this as I'm out of ideas.

Via Active questions tagged javascript - Stack Overflow https://ift.tt/74UcPJO

Comments

Popular posts from this blog

Where and how is this Laravel kernel constructor called? [closed]

Where and how is this Laravel kernel constructor called? public fucntion __construct(Application $app, $Router $roouter) { } I have read the documentation and some online tutorial but I can find any clear explanation. I am learning Laravel and I am wondering where does this kernel constructor receives its arguments from. "POSTMOTERM" CLARIFICATION: Here is more clarity.I have checked the boostrap/app.php and it is only used for boostrapping the interfaces into the container class. What is not clear to me is where and how the Kernel class is instatiated and the arguments passed to the object calling the constructor.Something similar to; obj = new kernel(arg1,arg2) or, is the framework using some magic functions somewhere? Special gratitude to those who burn their eyeballs and brain cells on this trivia before it goes into a full blown menopause alias "MARKED AS DUPLICATE". To some of the itchy-finger keyboard warriors, a.k.a The mods,because I believe in th...

Why is my reports service not connecting?

I am trying to pull some data from a Postgres database using Node.js and node-postures but I can't figure out why my service isn't connecting. my routes/index.js file: const express = require('express'); const router = express.Router(); const ordersCountController = require('../controllers/ordersCountController'); const ordersController = require('../controllers/ordersController'); const weeklyReportsController = require('../controllers/weeklyReportsController'); router.get('/orders_count', ordersCountController); router.get('/orders', ordersController); router.get('/weekly_reports', weeklyReportsController); module.exports = router; My controllers/weeklyReportsController.js file: const weeklyReportsService = require('../services/weeklyReportsService'); const weeklyReportsController = async (req, res) => { try { const data = await weeklyReportsService; res.json({data}) console...

How to show number of registered users in Laravel based on usertype?

i'm trying to display data from the database in the admin dashboard i used this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count(); echo $users; ?> and i have successfully get the correct data from the database but what if i want to display a specific data for example in this user table there is "usertype" that specify if the user is normal user or admin i want to user the same code above but to display a specific usertype i tried this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count()->WHERE usertype =admin; echo $users; ?> but it didn't work, what am i doing wrong? source https://stackoverflow.com/questions/68199726/how-to-show-number-of-registered-users-in-laravel-based-on-usertype