Home > Net >  onclick an <li> to open local redirect
onclick an <li> to open local redirect

Time:08-30

Hello i am just building a website for a FiveM Server. It has an button on it which is actually an li element and if you click it FiveM should locally open and connect to the Server with this Link fivem://connect/nextroleplay.de:30120. This works.

Because of that the Button is an li element i tried following with onclick

                   <li  onclick="location.href='fivem://connect/nextroleplay.de:30120">
                        <a href="#">
                            <i class='bx bx-play icon' ></i>
                            <span >JETZT SPIELEN</span>
                        </a>
                    </li>

But NOTHING happens. Why?

The "Button" looks like this:

Button

Menu

CodePudding user response:

You can create a Javascript function and then use that function in "onclick" event like below. Check this once.

function navigate() {
    location.href = "fivem://connect/nextroleplay.de:30120";
}
<li  onclick="navigate()">
        <a href="#">
            <i class=' bx bx-play icon'></i>
            <span >JETZT SPIELEN</span>
        </a>
    </li>

CodePudding user response:

Missing quote check below

 <li  onclick="location.href='fivem://connect/nextroleplay.de:30120'">
                        <a href="#">
                            <i class='bx bx-play icon' ></i>
                            <span >JETZT SPIELEN</span>
                        </a>
                    </li>
  • Related