Reputation: 1257
How to remove a Radio button value on onload of page..here is the list of radio button so dynamically i have to remove this value <input type="radio" name=myradio value="Null">Null
<input type="radio" name=myradio value="Bill">one
<input type="radio" name=myradio value="Sale">two
<input type="radio" name=myradio value="Null">Null
Upvotes: 0
Views: 992
Reputation: 9561
Below script will remove the radio button with value null.
$(document).ready(function(){
$("input[type='radio'][name='myradio'][value='Null']").remove();
});
Upvotes: 0
Reputation: 3765
window.onload = function() {
var myradios= document.getElementsByName('myradio'); //Get all myradio elements from document
for (var i = 0; i < myradios.length; i++) { //Loop all myradio elements
if (myradios[i].value == 'Null') { //If value of element == null
myradios[i].parentNode.removeChild(myradios[i].nextSibling); //Removes the "Null"-Text
myradios[i].parentNode.removeChild(myradios[i]); //Removes the radio button
}
}
}
Upvotes: 1
Reputation: 630
You can try this- first make a Javascript function like:
<script>
function remvalue()
{
document.getElementById('myradiobutton').value="";
}
window.onload=remvalue;
</script>
And then assign the ID to the radio button:
<input type="radio" id=myradiobutton name=myradio value="Null">Null
Upvotes: 1