Let’s say we have 3 buttons and we want to show them on the same line: #outer { width:100%; text-align: center; } .inner { display: inline-block; } <div id=”outer”> <div class=”inner”><button type=”submit” class=”msgBtn” onClick=”return false;” >Save</button></div> <div class=”inner”><button type=”submit” class=”msgBtn2″ onClick=”return false;”>Publish</button></div> <div class=”inner”><button class=”msgBtnBack”>Back</button></div> </div>
Tag: button
How to check if javascript is enabled on the client’s browser
The noscript element represents nothing if scripting is enabled, and represents its children if scripting is disabled. It is used to present different markup to user agents that support scripting and those that don’t support scripting, by affecting how the document is parsed. <script type=”text/javascript”> //If javascript enabled then this part will work. //Your javascript code here… </script> <noscript>JavaScript disabled on your […]
How to disable ASP.Net button after click to prevent double clicking
Let’s say you have 2 buttons on your web page. <form id=”form1″ runat=”server”> <asp:Button ID=”Button1″ runat=”server” Text=”Button1″ OnClick=”Button1_Clicked” /> <asp:Button ID=”Button2″ runat=”server” Text=”Button2″ /> </form> Scenario 1: Disabling the specific button <script type=”text/javascript”> function DisableButton() { document.getElementById(“<%=Button1.ClientID %>”).disabled = true; } window.onbeforeunload = DisableButton; </script> The DisableButton JavaScript function is used for disabling specific Button when Clicked. […]
Change button size full-width in Bootstrap
Bootstrap v3 & v4 Use btn-block class on your button/element Bootstrap v2 Use input-block-level class on your button/element
How to show a button with condition in PHP
Scenario: Let’s say we have “Get Details” and “Update Details” buttons. And we want to make visible Update button after we fire the “Get Details” button. This is Get Details button:
Navigate to a Div using a button in HTML
The Div: <div id=”DivToNavigate”> The content goes here… </div>
Fire Combobox SelectedIndexChanged with button code-behind
myComboBox_SelectedIndexChanged(myComboBox, new EventArgs()); // or (null, null)