Questions tagged [button]

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

In computing, a button (sometimes known as a command button or push button) is a user interface element that provides the user a simple way to trigger an event, like executing a query on a search engine or to interact with dialog boxes to confirm an action.

When asking questions specific to a particular framework or language, it's best to use the appropriate tag instead (if it's available). For example, the HTML <button> element should be tagged with , iOS buttons should be tagged with , and Java Swing buttons should be tagged with .

40417 questions
2635
votes
35 answers

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
  • 227,796
  • 193
  • 515
  • 708
1880
votes
17 answers

When looking at most sites (including SO), most of them use: instead of: What are the main differences between the two, if any? Are there valid reasons to use one instead of the other? Are there valid…
Aron Rotteveel
  • 81,193
  • 17
  • 104
  • 128
1449
votes
31 answers

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 button on my current page, so I can't simply make…
kdenney
  • 18,343
  • 4
  • 31
  • 27
663
votes
8 answers

Can I make a

I've got a form, with 2 buttons I use jQuery UI's button on them too, simply like this $('button').button(); However, the first button also submits the…
alex
  • 479,566
  • 201
  • 878
  • 984
577
votes
19 answers

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 the possibility to add text. If I use Button I can…
znq
  • 44,613
  • 41
  • 116
  • 144
460
votes
19 answers

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() and a switch statement to do the button logic. With…
smith324
  • 13,020
  • 9
  • 37
  • 58
412
votes
8 answers

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
  • 14,571
  • 16
  • 49
  • 70
377
votes
8 answers

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 link even when clicked?
Pooja Jain
326
votes
13 answers

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 button in that component fires the onClick…
Stralos
  • 4,895
  • 4
  • 22
  • 40
321
votes
17 answers

How do I disable a Button in Flutter?

I'm just starting to get the hang of Flutter, but I'm having trouble figuring out how to set the enabled state of a button. 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 if the…
chris84948
  • 3,940
  • 3
  • 22
  • 25
270
votes
14 answers

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't work. How should I fix this? Here is my…
Sam Bates
  • 2,807
  • 3
  • 13
  • 6
268
votes
14 answers

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='press', command=action) The method action is called…
Jack
  • 5,264
  • 7
  • 34
  • 43
265
votes
21 answers

How to remove padding around buttons in Android?

In my Android app, I have this layout:
omega
  • 40,311
  • 81
  • 251
  • 474
261
votes
28 answers

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 for either version, when I do try the button just…
mail929
  • 2,768
  • 3
  • 15
  • 12
1
2 3
99 100