2
I need your help: I have two radiobutton
, and I wanted to turn them into checkbox
, only I can not change the type
for checkbox
, on this radio I could make to select and to remove if you want.
Could someone help me?
2
I need your help: I have two radiobutton
, and I wanted to turn them into checkbox
, only I can not change the type
for checkbox
, on this radio I could make to select and to remove if you want.
Could someone help me?
0
Leonardo,
Put one of these options on your radiobutton onClick:
this.checked = false;
$(this).prop('checked', false);
$(this).attr('checked', false);
$(this).removeAttr('checked');
If placed in a separate javascript you can replace this
for '#idRadioBtn'
It is also possible to search for all radio elements:
$("input:radio").attr("checked", false);
$("input:radio").removeAttr("checked");
The above operations are for cancel the selected element, to do otherwise simply change the parameters false
for true
.
You may need a control logic. To check which state the element uses:
document.querySelector('input[name="nomeSeuRadio"]:checked').value;
didn’t work :\
You put in the click event?
@rafael yes I put
@Leonardomacedo had put example for checkbox and not for radiobutton, try again...
Browser other questions tagged javascript razor radiobutton
You are not signed in. Login or sign up in order to post.
Very careful with these "differentiated" components, users are used to a specific operating pattern of each component and they will require that this pattern does not change... just a hint . the.
– MarioAleo
@Marioaleo Thanks for the tip!
– Leonardo Macedo