Making an image act like a button

It sounds like you want an image button: <input type=”image” src=”https://stackoverflow.com/questions/16131988/logg.png” name=”saveForm” class=”btTxt submit” id=”saveForm” /> Alternatively, you can use CSS to make the existing submit button use your image as its background. In any case, you don’t want a separate <img /> element on the page.

assign id to jquery dialog button

The following (seemingly undocumented) works for me with jQuery 1.8.9: $(“#dlg”).dialog({ buttons : { “MyButton” : { text: “My Button”, id: “my-button-id”, click: function(){ alert(“here”); } } } }); The button can be addressed via $(“#my-button-id”)

How can I keep a button as pressed after clicking on it? [duplicate]

I had this issue with a button with a custom background, and ended up using the selected state for this. That state is available for all views. To use this you have to define a custom button background as a state list: <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_selected=”false” android:state_focused=”false” android:state_pressed=”false”><bitmap … /></item> <item android:state_selected=”true”><bitmap … /></item> <item … Read more

Run a shell script with an html button

As stated by Luke you need to use a server side language, like php. This is a really simple php example: <?php if ($_GET[‘run’]) { # This code will run if ?run=true is set. exec(“/path/to/name.sh”); } ?> <!– This link will add ?run=true to your URL, myfilename.php?run=true –> <a href=”https://stackoverflow.com/questions/6235785/?run=true”>Click Me!</a> Save this as myfilename.php … Read more

How can I set size of a button?

The following bit of code does what you ask for. Just make sure that you assign enough space so that the text on the button becomes visible JFrame frame = new JFrame(“test”); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPanel panel = new JPanel(new GridLayout(4,4,4,4)); for(int i=0 ; i<16 ; i++){ JButton btn = new JButton(String.valueOf(i)); btn.setPreferredSize(new Dimension(40, 40)); panel.add(btn); } … Read more

I have to click the button twice for it to work

My problem was the Button XML defining: android:focusableInTouchMode=”true” Remove this attribute and the button doesn’t require being touched twice. It appears as though the first touch is consumed to assign focus on the button and the second then triggers the OnClickListener. Note that the Button works without issue with the android:focusable=”true” attribute.

How can I hide/show a div when a button is clicked?

Use JQuery. You need to set-up a click event on your button which will toggle the visibility of your wizard div. $(‘#btn’).click(function() { $(‘#wizard’).toggle(); }); Refer to the JQuery website for more information. This can also be done without JQuery. Using only standard JavaScript: <script type=”text/javascript”> function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == … Read more

making a input type “file” hidden with button

You can actually do it with label, you just have to hide the input. <!– head –> <link href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css” rel=”stylesheet”/> <!– body –> <label for=”upload”> <span class=”glyphicon glyphicon-folder-open” aria-hidden=”true”></span> <input type=”file” id=”upload” style=”display:none”> </label>