Display Boolean Value In Radio Button
I have the following loop to display data in a view, I need help displaying radio button. I have flag field in my database it has value either 0 or 1. I want to display that in rad
Solution 1:
You can do something like this:
var n = 0; // set your bool value here 0/1if(n===1)
{
document.getElementById("yourRadiobtn").checked = true;
}
else
{
document.getElementById("yourRadiobtn").checked = false;
}
<inputtype="radio"name="colors"id="yourRadiobtn">Item
If you're using a bool type then
var n = false ; // set your bool value here (true/false)if(n === true)
{
document.getElementById("yourRadiobtn").checked = true;
}
else
{
document.getElementById("yourRadiobtn").checked = false;
}
<inputtype="radio"name="colors"id="yourRadiobtn">Item
Post a Comment for "Display Boolean Value In Radio Button"