htmlbutton

Valid to use <a> (anchor tag) without href attribute?

元气小坏坏 提交于 2019-11-26 19:28:16
I've been using Twitter Bootstrap to build a site, and a lot of its functionality depends on wrapping things in <a> , even if they're just going to execute Javascript. I've had problems with the href="#" tactic that Bootstrap's documentation recommends, so I was trying to find a different solution. But then I tried just removing the href attribute altogether. I've been using <a class='bunch of classes' data-whatever='data'> , and having Javascript handle the rest. And it works. Yet something's telling me I shouldn't be doing this. Right? I mean, technically <a> is supposed to be a link to

Button type “button” vs. “submit”

送分小仙女□ 提交于 2019-11-26 14:08:35
问题 Is there a difference between a button with type="button" vs type="submit" ? Are there functional differences, or is it just a descriptive name for easier code reading? Is this different than input ? 回答1: From MDN: type The type of the button. Possible values are: submit : The button submits the form data to the server. This is the default if the attribute is not specified , or if the attribute is dynamically changed to an empty or invalid value. reset : The button resets all the controls to

How can I use the button tag with ASP.NET?

纵饮孤独 提交于 2019-11-26 07:58:32
问题 I\'d like to use the newer <button> tag in an ASP.NET website which, among other things, allows CSS-styled text and embedding a graphic inside the button. The asp:Button control renders as <input type=\"button\"> , is there any way to make a preexisting control render to <button> ? From what I\'ve read there is an incompatibility with IE posting the button\'s markup instead of the value attribute when the button is located within a <form> , but in ASP.NET it will be using the onclick event to

Valid to use <a> (anchor tag) without href attribute?

我的梦境 提交于 2019-11-26 06:59:13
问题 I\'ve been using Twitter Bootstrap to build a site, and a lot of its functionality depends on wrapping things in <a> , even if they\'re just going to execute Javascript. I\'ve had problems with the href=\"#\" tactic that Bootstrap\'s documentation recommends, so I was trying to find a different solution. But then I tried just removing the href attribute altogether. I\'ve been using <a class=\'bunch of classes\' data-whatever=\'data\'> , and having Javascript handle the rest. And it works. Yet

How to create an HTML button that acts like a link?

大憨熊 提交于 2019-11-25 21:40:04
问题 I would like to create an HTML button that acts like a link. So, when you click the button, it redirects to a page. I would like it to be as accessible as possible. I would also like it so there aren\'t any extra characters, or parameters in the URL. How can I achieve this? Based on the answers posted so far, I am currently doing this: <form method=\"get\" action=\"/page2\"> <button type=\"submit\">Continue</button> </form> but the problem with this is that in Safari and Internet Explorer, it