You can include <label> element as parent of <input type="radio"> elements at html.
The HTML Label Element (<label>) represents a caption for an item
in a user interface. It can be associated with a control either by
placing the control element inside the <label> element, or by using
the for attribute. Such a control is called the labeled control of
the label element. One input can be associated with multiple labels.
The parent label element will be associated with :checked first child descendant input.
You can style css :after pseudo element compounded to :checked selector to display blue border when input element is :checked.
div.radio {
display: inline-block;
}
label.radio {
display: inline-block;
width: 100px;
border: 1px solid #000;
}
label.radio > :checked:after {
content: "";
position: relative;
display: inline-block;
width: 100px;
height: 20px;
left: -6px;
top: -4px;
border: 1px solid blue;
}
<div class="radio">
<label class="radio">
<input type="radio" id="radio1" name="name[]" checked>
</label>
</div>
<div class="radio">
<label class="radio">
<input type="radio" for="radio2" name="name[]">
</label>
</div>
If requirement is to use existing html, jQuery, you can utilize .click(), .toggleCLass() to add, remove "new" className if descendant input element checked property is false at click event, set input checked property to true
$(document).ready(function() {
var radio = $(".radio");
radio.click(function(e) {
var input = e.target.querySelector("input[type=radio]");
if (!input.checked) {
radio.toggleClass("new");
input.checked = true;
}
})
})
.radio {
display: inline-block;
width: 100px;
border: 1px solid #000;
}
.new {
display: inline-block;
width: 100px;
border: 1px solid blue !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<div class="radio new">
<input type="radio" name="name[]" checked>
</div>
<div class="radio">
<input type="radio" name="name[]">
</div>