button href is ignoring everything after question mark - html

I have this button
<button href="account.html?gto=4356">go to</button>
On click it redirects to ./account.html?# though i was expecting ./account.html?gto=4356.
Why is it ignoring everything after the question mark and how can I make this work?

Button tag does not support href attribute. instead use a tag and css design to make it look like a button.
go to
Hope it will help you.

You can do it with Javascript
<button onclick='goto()'>go to</button>
<script>
function goto(){
location.replace("account.html?gto=4356");
}
</script>

You Have to do it like this
<button>go to</button>
I hope this works for you! regards

Related

my href link isn't working with my button in my html document

so basically I have this button that doesn't work, when I hover over it my cursor doesn't change and when I click it nothing happens, here's the buttons line of code:
<button href="dwr.php" class="dwrbutton fas fa-address-card"> <div class="dwrtext">DWR</div></button>
Href is not a button attribute.
https://www.w3schools.com/tags/tag_button.asp
Use a form with the link as action, or try a <A> tag with styling
add button class to anchor tag
<div class="dwrtext">DWR</div>
If you want to set a href on your button simply wrap it with an anchor element.
Your code should look something like this:
<button href="dwr.php" class="dwrbutton fas fa-address-card">DWR</button>
If you really need to use the button-tag, then you should look here for a solution to your problem. Especially preferred if you need the button-tag within a form.
If you don't care how the link is implemented, then I would personally use an a-tag, which you can then design according to your preferences, also like a button.
Have fun and good luck!

How can I create link that does nothing?

I want to create a link that does NOTHING, it means that its a fake link
Im trying with onclick="mijava();return false;" but it scrolls up in the website
How can I do it?
javascript:
document.getElementById("nothing").addEventListener("click", function(event){
event.preventDefault()
});
html:
<a id="nothing" href="#">Link</a>
JSFiddle
"javascript:void(0)" to href attribute, the <a> tag will do nothing.
This won't do anything.
Link
Do you test it that?
link
You can use CSS to style it like a link and you probably don't want to use an anchor tag if it's not going to act like one.
See this answer: How to make an anchor tag refer to nothing?

div onclick doesn't work for some reason

It's a very simple question and I'm amazed how is this not working for me, somehow this code:
<div id="logoutDiv" onClick="php_includes/logout.php"></div>
doesn't work, when I press on the div. What's the problem? I know that this is a very basic question, but somehow I've got stuck on it.
onclick is a JavaScript event. What you wrote is not JavaScript.
Maybe:
onclick="window.location.href='php_includes/logout.php';"
onClick only works with Javascript, not with links. Try this instead:
<div id="logoutDiv"></div>
Use window.location to call another page. <div id="myButton" onclick="window.location = 'php_includes/logout.php';">Page 2</div>

Use anchor tag for calling an Action

First I tried with
<input type="button" value="Something" onclick="location.href='#Url.Action("ActionName")'" />
But this is a button and I want just a link. I've seen somewhere (while wildly browsing the programming forums) a way to hide a button link behind an anchor, but couldn't find/make it.
Then I tried with
(here, actually, on the page, the link looked like Something">, whereas the " and > shouldn't be there)
and also
Something
but the latter 2 ways (with the anchor tag) don't work, by means, I don't get directed to the other page. So, any suggestions about how to hide a button behind a link, or how to make the anchor tags run ?
You want an anchor, but the suggested code doesn't work. Try this way (it worked for me):
<a onclick="location.href='#Url.Action("ActionName")'">Something</a><br />
It will work this way, but you will not have the hand, when you hover the link. So just add href="#", like that:
Something<br />
Use #Html.ActionLink("Something", "ActionName", "ControllerName") without the <a> tag. It's generated automatically
<a asp-action="Index">Location Name</a>

Tooltips for Button elements

Is it possible to create a tooltip for an html button. Its the normal HTML button and there is no Title attribute as it is there for some html controls. Any thoughts or comments?
Simply add a title to your button.
<button title="Hello World!">Sample Button</button>
both <button> tag and <input type="button"> accept a title attribute..
Use title attribute.
It is a standard HTML attribute and is by default rendered in a tooltip by most desktop browsers.
For everyone here seeking a crazy solution, just simply try
title="your-tooltip-here"
in any tag. I've tested into td's and a's and it pretty works.
A button accepts a "title" attribute. You can then assign it the value you want to make a label appear when you hover the mouse over the button.
<button type="submit" title="Login">
Login</button>
The title attribute is meant to give more information. It's not useful for SEO so it's never a good idea to have the same text in the title and alt which is meant to describe the image or input is vs. what it does. for instance:
<button title="prints out hello world">Sample Buttons</button>
<img title="Hms beagle in the straits of magellan" alt="HMS Beagle painting" src="hms-beagle.jpg" />
The title attribute will make a tool tip, but it will be controlled by the browser as far as where it shows up and what it looks like. If you want more control there are third party jQuery options, many css templates such as Bootstrap have built in solutions, and you can also write a simple css solution if you want. check out this w3schools solution.
If your button still doesn't show anything with title, check if your button is NOT disabled
You should use both title and alt attributes to make it work in all browsers.
<button title="Hello World!" alt="Hello World!">Sample Button</button>