Bootstrap Tutorial

Bootstrap Fixed Navbar | Sticky Top | Sticky Header Bootstrap CDN 5.3, 5.2, 4.6, 4.3, 3.4, 3.3 (New Links) | Bootstrap CDN 5, 4, 3 File Download Bootstrap 5 Modal Disable Outside Click Bootstrap Horizontal and Vertical Divider Bootstrap Modal Pass data Dynamically Bootstrap Confirm Delete Modal | Popup Bootstrap Add Space Between Rows | Margin Bootstrap Remove Modal Background Bootstrap Make Table Row Clickable Bootstrap Change modal background color Bootstrap Center Align Form Bootstrap Show Image in Modal | Popup Bootstrap Button Icon with Text Bootstrap Scrollable Modal Bootstrap Image Center Align Bootstrap Dropdown with Icon Bootstrap Get Checkbox checked value Bootstrap Uncheck radio Button Bootstrap Set Radio button default checked or selected Bootstrap Radio Button Validation Bootstrap Enable Disable Radio Button Bootstrap Radio Button Checked Event Bootstrap get radio button checked or selected value Bootstrap Disable Enable Button on Click Bootstrap Tooltip on Input Field Elements Bootstrap Fixed Footer Bootstrap Image Upload | file Upload Bootstrap Modal on page load Bootstrap Login Form Template Bootstrap Add Search icon with Search bar Bootstrap button tooltip on hover Bootstrap Icons CDN Latest Version (1.11.3) Bootstrap Tabs Panel Pass dynamic content Bootstrap Change Dropdown Menu Background Color Bootstrap Avoid Dropdown Menu to close menu items on clicking inside Bootstrap Table Remove Border Bootstrap Modal Example Bootstrap Center Align Input Field Bootstrap Change Icon Color Bootstrap Text Align Center | Middle Bootstrap Remove all Rounded Corners Bootstrap Alerts Example Bootstrap Alert with Icons Bootstrap Scroll to Top Button Bootstrap Button Loading Spinner Bootstrap Check if Modal is Shown or Hidden Bootstrap Dropdown Button Change Text on Selection Bootstrap Remove offcanvas Backdrop Bootstrap Textarea Height Auto Resize Bootstrap selectpicker Get Selected Value Glyph Trash Icon

Bootstrap Set Radio button default checked or selected

Bootstrap Set Radio button default checked or selected:In Bootstrap, to set a radio button as default checked or selected, you can use the checked attribute.
 
By adding the checked attribute to the desired radio button input element, it will be selected by default when the page loads.
 
For example, <input type="radio" name="example" id="option1" checked> will make the radio button with the ID "option1" selected by default. This allows you to pre-select a specific option in a group of radio buttons in Bootstrap.
Profile Photo

Abhishek Yadav (SD) SDE of FAI

Feedback

written
Profile Photo

Anil Kumar (Expert) Coding Expert of FAI

Feeback

reviewed
Profile Photo
Jun 04, 2023 12:06 PM Last Updated
updated

How can I set a default checked or selected option for a Bootstrap Set Radio Button?

This code snippet demonstrates how to set a default checked or selected radio button using Bootstrap. The checked attribute is added to the desired input element, such as id="radio2", to make it selected by default.

The JavaScript code uses jQuery to handle the change event of the radio buttons. When a radio button is selected, its value is retrieved and displayed in the <span> element with the id "selectedEntrepreneur".

The trigger('change') function is used to initially trigger the change event on page load.

Bootstrap Set Radio Button default checked or selected Example

Copied to Clipboard
Run

Output of Bootstrap Radio button default checked or selected

Ad