Questions tagged [button]

Buttons are simple elements in graphical user interfaces that take mouse clicks or finger taps (on touch devices) as input.

button
Filter by
Sorted by
Tagged with
2699 votes
37 answers
9.6m views

How do I create an HTML button that acts like a link?

How do I create an HTML button that acts like a link? So that clicking the button redirects the user to a page. I want it to be accessible, and with minimal extra characters or parameters in the URL.
Andrew's user avatar
  • 233k
1892 votes
17 answers
691k views

<button> vs. <input type="button" />. Which to use?

When looking at most sites (including SO), most of them use: <input type="button" /> instead of: <button></button> What are the main differences between the two, if any? Are ...
Aron Rotteveel's user avatar
1460 votes
31 answers
1.8m views

Trigger a button click with JavaScript on the Enter key in a text box

I have one text input and one button (see below). How can I use JavaScript to trigger the button's click event when the Enter key is pressed inside the text box? There is already a different submit ...
kdenney's user avatar
  • 18.5k
682 votes
8 answers
477k views

Can I make a <button> not submit a form?

I've got a form, with 2 buttons <a href="index.html"><button>Cancel changes</button></a> <button type="submit">Submit</button> I use jQuery UI's button on them ...
alex's user avatar
  • 485k
578 votes
19 answers
628k views

Android: combining text & image on a Button or ImageButton

I'm trying to have an image (as the background) on a button and add dynamically, depending on what's happening during run-time, some text above/over the image. If I use ImageButton I don't even have ...
znq's user avatar
  • 44.8k
460 votes
19 answers
276k views

How to handle button clicks using the XML onClick within Fragments

Pre-Honeycomb (Android 3), each Activity was registered to handle button clicks via the onClick tag in a Layout's XML: android:onClick="myClickMethod" Within that method you can use view.getId()...
smith324's user avatar
  • 13k
422 votes
8 answers
533k views

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?
SARAVAN's user avatar
  • 14.8k
383 votes
8 answers
375k views

How to make button look like a link?

I need to make a button look like a link using CSS. The changes are done but when I click on it, it shows as if it's pushed as in a button. Any idea how to remove that, so that the button works as a ...
user avatar
347 votes
17 answers
359k views

How do I disable a Button in Flutter?

I'm having trouble figuring out how to set the enabled state of a button in Flutter. From the docs, it says to set onPressed to null to disable a button, and give it a value to enable it. This is fine ...
chris84948's user avatar
  • 4,210
329 votes
13 answers
210k views

React onClick function fires on render

I pass 2 values to a child component: List of objects to display delete function. I use a .map() function to display my list of objects(like in the example given in react tutorial page), but the ...
Stralos's user avatar
  • 4,965
274 votes
6 answers
374k views

Best way to disable button in Twitter's Bootstrap [duplicate]

I am confused when it comes to disabling a <button>, <input> or an <a> element with classes: .btn or .btn-primary, with JavaScript/jQuery. I have used a following snippet to do that:...
user avatar
270 votes
21 answers
184k views

How to remove padding around buttons in Android?

In my Android app, I have this layout: <?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="...
omega's user avatar
  • 42.2k
270 votes
14 answers
652k views

How to center buttons in Twitter Bootstrap 3?

I am building a form in Twitter Bootstrap but I'm having issues with centering the button below the input in the form. I have already tried applying the center-block class to the button but that didn'...
Sam Bates's user avatar
  • 2,807
270 votes
14 answers
476k views

How to pass arguments to a Button command in Tkinter?

Suppose I have the following Button made with Tkinter in Python: import Tkinter as Tk win = Tk.Toplevel() frame = Tk.Frame(master=win).grid(row=1, column=1) button = Tk.Button(master=frame, text='...
Jack's user avatar
  • 5,324
261 votes
28 answers
194k views

Coloring Buttons in Android with Material Design and AppCompat

Before the AppCompat update came out today I was able to change the color of buttons in Android L but not on older versions. After including the new AppCompat update I am unable to change the color ...
mail929's user avatar
  • 2,768
254 votes
10 answers
279k views

Display a tooltip over a button using Windows Forms

How can I display a tooltip over a button using Windows Forms?
user avatar
253 votes
11 answers
463k views

Android - border for button

How do I add a border to a button? Is it possible to do this without resorting to use of images?
jeffreyveon's user avatar
  • 13.6k
249 votes
9 answers
322k views

How to wrap text of HTML button with fixed width?

I just noticed that if you give an HTML button a fixed width, the text inside the button is never wrapped. I've tried it with word-wrap, but that cuts of the word even though there are spaces ...
Peter's user avatar
  • 14.4k
245 votes
13 answers
498k views

How to Set Opacity (Alpha) for View in Android

I have a button as in the following: <Button android:text="Submit" android:id="@+id/Button01" android:layout_width="fill_parent" android:layout_height="wrap_content"> &...
ncakmak's user avatar
  • 4,024
240 votes
6 answers
219k views

Disable form auto submit on button click

I have a HTML form where I use several buttons. The problem is that no matter which button I click, the form will get submitted even if the button is not of type "submit". e.g. Buttons like :<...
Paris's user avatar
  • 6,541
234 votes
24 answers
237k views

How to hide close button in WPF window?

I'm writing a modal dialog in WPF. How do I set a WPF window to not have a close button? I'd still like for its WindowState to have a normal title bar. I found ResizeMode, WindowState, and ...
Michael Hedgpeth's user avatar
232 votes
16 answers
180k views

How to remove button shadow (android)

I want to remove the shadow from the button to make it seem more flat. I have this right now: But I want this:
sousheel's user avatar
  • 2,449
221 votes
12 answers
169k views

Cannot lower case button text in android studio

I have a trivial question that has been bothering me for a while. I tried to google this but no one seems to have the same problem as me or doesn't see it as an issue. When I make a button in ...
Alex's user avatar
  • 3,611
220 votes
7 answers
558k views

Remove the complete styling of an HTML button/submit

Is there a way of completely removing the styling of a button in Internet Explorer? I use a css sprite for my button, and everything looks ok. But when I click the button, it moves to the top a ...
Saif Bechan's user avatar
  • 16.8k
218 votes
17 answers
553k views

How to remove outline border from input button

When I click somewhere else the border disappears, I tried to use onfocus: none, but that didn't help. How to make this ugly button border disappear when I click on it? input[type=button] { ...
Cindy Turlington's user avatar
203 votes
10 answers
454k views

How to add a spinner icon to button when it's in the Loading state?

Twitter Bootstrap's buttons have a nice Loading... state available. The thing is that it just shows a message like Loading... passed through the data-loading-text attribute like this: <button ...
Leniel Maccaferri's user avatar
201 votes
6 answers
171k views

How can I build multiple submit buttons django form?

I have form with one input for email and two submit buttons to subscribe and unsubscribe from newsletter: <form action="" method="post"> {{ form_newsletter }} <input type="submit" name="...
veena's user avatar
  • 2,053
199 votes
15 answers
168k views

Bootstrap control with multiple "data-toggle"

Is there a way to assign more than one event to a bootstrap control via "data-toggle"? For example, let's say I want a button that has a "tooltip" and a "button" toggle ...
LastTribunal's user avatar
  • 6,392
194 votes
12 answers
961k views

Embed image in a <button> element

I'm trying to display a png image on a <button> element in HTML. The button is the same size as the image, and the image is shown but for some reason not in the center - so it's impossible to ...
Amit Hagin's user avatar
  • 3,186
187 votes
14 answers
591k views

Remove border from buttons

I tried to create buttons and insert my own images instead of the standard button images. However, the gray border from the standard buttons still remains, showing on the outside of my black button ...
JamesonW's user avatar
  • 1,903
187 votes
13 answers
1.4m views

How to call a PHP function on the click of a button

I have created a page called functioncalling.php that contains two buttons, Submit and Insert. I want to test which function is executed when a button gets clicked. I want the output to appear on the ...
Razor's user avatar
  • 2,601
186 votes
8 answers
223k views

Android: ListView elements with multiple clickable buttons

I've a ListView where every element in the list contains a TextView and two different Buttons. Something like this: ListView -------------------- [Text] [Button 1][Button 2] -------------------- [...
znq's user avatar
  • 44.8k
180 votes
19 answers
374k views

Wrapping a react-router Link in an html button

Using suggested method: This is the result: A link in the button, Code in between comment lines I was wondering if there is a way to wrap a Link element from 'react-router' in an HTML button tag ...
Jose Rivera's user avatar
  • 1,911
179 votes
6 answers
250k views

Disable submit button when form invalid with AngularJS

I have my form like this: <form name="myForm"> <input name="myText" type="text" ng-model="mytext" required /> <button disabled="{{ myForm.$invalid }}">Save</button> &...
ali's user avatar
  • 11k
175 votes
10 answers
163k views

Android AlertDialog Single Button

I'd like to have an AlertDialog builder that only has one button that says OK or Done or something, instead of the default yes and no. Can that be done with the standard AlertDialog, or would I have ...
Elec0's user avatar
  • 2,280
171 votes
19 answers
254k views

How to bring view in front of everything?

I have activity and a lot of widgets on it, some of them have animations and because of the animations some of the widgets are moving (translating) one over another. For example the text view is ...
Lukap's user avatar
  • 31.8k
170 votes
6 answers
1.0m views

How to make an input type=button act like a hyperlink and redirect using a get request? [duplicate]

How do I make a <input type=button> act like a hyperlink and redirect using a GET request?
Blankman's user avatar
  • 263k
167 votes
11 answers
412k views

How do I make an HTML button not reload the page

I have a button (<input type="submit">). When it is clicked the page reloads. Since I have some jQuery hide() functions that are called on page load, this causes these elements to be hidden ...
Ankur's user avatar
  • 50.7k
167 votes
17 answers
755k views

Button that refreshes the page on click

I need a button that will refresh the page on the user's click. I tried this: <input type="button" value="Reload Page" onClick="reload"> or <input type="button" value="Refresh Page" ...
Stefan Đorđević's user avatar
164 votes
13 answers
99k views

How to make a circular ripple on a button when it's being clicked?

Background On the dialer app of Android, when you start searching for something, and you click the arrow button on the left of the EditText, you get a circular ripple effect on it : The problem I'...
android developer's user avatar
164 votes
10 answers
160k views

How to programmatically click a button in WPF?

Since there's no button.PerformClick() method in WPF, is there a way to click a WPF button programmatically?
tghoang's user avatar
  • 2,035
164 votes
11 answers
389k views

Put buttons at bottom of screen with LinearLayout?

I have the following code, how do I make it so that the 3 buttons are at the bottom? <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:...
thedeepfield's user avatar
  • 6,168
156 votes
3 answers
136k views

Difference between <input type='submit' /> and <button type='submit'>text</button>

There are many legends about them. I want to know the truth. What are the differences between the two following examples? <input type='submit' value='text' /> <button type='submit'>text&...
James's user avatar
  • 42.9k
150 votes
23 answers
461k views

Change the "No file chosen":

I have a button "Choose file" as follows (I am using Jade but it should be the same as Html5): input(type='file', name='videoFile') In the browser this shows a button with a text next to it "No ...
FranXh's user avatar
  • 4,641
150 votes
3 answers
70k views

How to add a custom button state

For instance, the default button has the following dependencies between its states and background images: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas....
Vit Khudenko's user avatar
  • 28.3k
149 votes
29 answers
227k views

How to center icon and text in a android button with width set to "fill parent"

I want to have an Android Button with icon+text centered inside it. I'm using the drawableLeft attribute to set the image, this works well if the button has a width of "wrap_content" but I need to ...
jloriente's user avatar
  • 1,521
145 votes
6 answers
623k views

Align button at the bottom of div using CSS

I want to align my button at the bottom right corner of my div. How can I do that? Current css of div: float: right; width: 83%; margin-right: 0px; font-family: Arial, Helvetica, ...
Harry Joy's user avatar
  • 59.2k
142 votes
7 answers
152k views

How do you completely remove the button border in wpf?

I'm trying to create a button that has an image in it and no border - just like the Firefox toolbar buttons before you hover over them and see the full button. I've tried setting the BorderBrush to ...
user avatar
141 votes
12 answers
466k views

How to put a link on a button with bootstrap?

How would one put a link on a button with bootstrap? there are 4 methods in the bootstrap documentation: <a href="#" class="btn btn-info" role="button">Link Button</a> <button type="...
Philayyy's user avatar
  • 1,847
140 votes
2 answers
97k views

How do I apply a style to all buttons of an Android application

I have a style applied to my whole application: AndroidManifest.xml: <application android:theme="@style/ApplicationStyle" android:icon="@drawable/icon" android:label="@string/app_name"> And ...
whlk's user avatar
  • 15.6k

1
2 3 4 5
813