How can I add any URL in this button HTML code? - html

<button type="button" class="btn btn-outline-secondary mb-3">Order now</button>
I have already tried adding href in between but it's not working.
<button type="button" class="btn btn-outline-secondary mb-3" href="http://webofpicasso.net">Order now</button>

you need to wrap your button In an anchor tag.
like this:
Order now</button>

Related

button tag inside anchor tag not working?

I have a problem.
I'm using a button in an a tag and I want the button clickable area to be the same as its container a. How can I do it?
Here an example of my code:
<a class="btn btn-success btn-sm btn-block"><i class="fa fa-user"></i> LOGIN
<button id="btnLogin" type="submit" class="btn btn-success btn-sm btn-block" runat="server" onserverclick="btnLogin_ServerClick">
</button>
</a>
EDIT:
Tried the height and width 100%, here's what happens:
Small rect. is the button
You can achieve your approach by moving the content <i class="fa fa-user"></i> LOGIN to be inside button tag.
Note : you can't using button element inside anchor element, it isn't valid HTML5 according to the HTML5 Spec Document from W3C
<a class="aan btn btn-success btn-sm btn-block">
<button id="btnLogin" type="submit" class="btn btn-success btn-sm btn-block" runat="server" onserverclick="btnLogin_ServerClick"><i class="fa fa-user"></i> LOGIN</button>
</a>

target a form using button

I want to create a clickable button which send me the user at the form section(at same page).
<button type="button" class="btn btn-primary btn-sm">
send me to the form
</button>
...
<form id="form1">
<div class="form-group">
...
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
But I didn't find any solution.
Is there any why to do it without rely on jquery/JS? If not then how to target the form? Here is my codepen in case you need it.
nest your button in the link tag this way:
<a href="#form-1">
<button type="button" class="btn btn-primary btn-sm">
send me to the form
</button>

Button type="submit" - unable to change label

I have a simple submit button like this:
<button
type="submit"
value="Create New Item"
className="btn btn-lg btn-primary btn-block mt-4"
/>
and I've been wondering, why the value (label of the button) has the default value instead of desired one ("Create New Item"), no matter what I do.
The same goes to input type="submit", but after reading this, I decided to stick with button.
Any ideas why I can't change the value?
<input type="submit" value="Create New Item" className="btn btn-lg btn-primary btn-block mt-4" />
Change button, to input type="submit"
Try this one,
<button onClick={onClickMethod}> Click Here </button>
if you want to change the text inside a button dynamically; you should set it like:
<button>{this.state.buttonLabel}</button>
Just use the element like this
<button type="submit" className="btn btn-lg btn-primary btn-block mt-4">Create
New Item</button/>
You no need to specify the input type, just replace with as below:
<button className="btn btn-lg btn-primary btn-block mt-4">
Create New Item
</button>
You can add onClick event.
PLease delcare the button as below
<button type="submit" className="btn btn-lg btn-primary btn-block mt-4">
Create New Item
</button>

Space between buttons with bootstrap class

I have a problem with three buttons on my site.
I would like to have some space between those buttons.
Is it possible to do this, without using inline styling?
Perhaps bootstrap has some classes for this?
I know I can simply do it with:
style='margin-right:5px;'
or write custom class with this property.
I am just wondering if bootstrap has some classes for this?
Here is example.
Problem is with this three buttons:
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
Try to put them inside btn-toolbar or some other container.
<div class="btn-toolbar">
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
</div>
Yes you have to wrap them
<div class="btn-group">
<button type="button" class="btn btn-primary">1/2</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary">1/2</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary">1/2</button>
</div>
EDITED CODEPEN
<div class="btn-toolbar">
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
<button type="button" class="btn btn-primary col-sm-1">1/2</button>
</div>
d-flex justify-content-between
<div class="col-md-3 mt-4 d-flex justify-content-betweend-flex justify-content-between">
<button type="submit" class="btn btn-info text-light" id="atndanceFilter"> <i class="fa fa-search"></i> Filter Report</button>
Reset
</div>
Will work like magic.

Bootstrap buttons with <a> tag don't group together

First, I am rather new to HTML so this may be simple.
<div class="btn-group pull-center" style="text-align:center">
<button class="btn btn-large btn-primary" type="button">Home</button>
<button class="btn btn-large btn-primary" type="button">Forum</button>
<button class="btn btn-large btn-primary" type="button">Bans</button>
<button class="btn btn-large btn-primary" type="button">Store</button>
<?php
if($_SESSION['isLogged'] == true) {
$username = $_SESSION['username'];
?> <button class="btn btn-large btn-primary" type="button">Hello, <?php $username ?></button>
<button class="btn btn-large btn-primary" type="button">Log out</button>
<?php }else {
?> <button class="btn btn-large btn-primary" type="button">Log in</button><?php
}
?>
</div>
Generally the btn-group class works and they group. However, if I add an A tag to a button, that button will not group.
Here are some screenshots
http://imgur.com/a/G1d6C
This should work for Bootstrap. And I have no buttons here:
<div class="btn-group">
<a class="btn">Home</a>
<a class="btn">Forum</a>
<a class="btn">Bans</a>
<a class="btn">Store</a>
Hello username
Log out
Log in
</div>
You're putting the .btn class inside a <a> tag. But, the twitter-bootstrap framework group buttons only if .btn elements are direct children of .btn-group. Indeed, the rule might be written with .btn-group > .btn.
Put the .btn class on your <a> tag and even remove this uselss button tag and it'll work. For example:
<div class="btn-group pull-center" style="text-align:center">
<a class="btn btn-large btn-primary" type="button">Home</a>
<a class="btn btn-large btn-primary" type="button">Forum</a>
<a class="btn btn-large btn-primary" type="button">Bans</a>
<a class="btn btn-large btn-primary" type="button">Store</a>
Hello, Username
Log out
</div>
Instead of using buttons, just add the btn class to the a tag instead. Example:
<div class="btn-group pull-center" style="text-align:center">
<a class="btn btn-large btn-primary">Home</a>
<a class="btn btn-large btn-primary">Forum</a>
<a class="btn btn-large btn-primary">Bans</a>
<a class="btn btn-large btn-primary">Store</a>
Hello, Username
Log out
Log in
</div>
Demo