Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radio button only renders radio button not text

 <input type="radio" id="rdoHalfDay" name="rdoHalfDay" value="Half Day" />

Above code only render radio button not text
I am using Firefox 9.0.1 also same problem in IE


<%=Html.RadioButton("rdoTest","Cricket") %>;

If I am using above code in Asp.net MVC 3 then below HTML generates that not shows text

<input id="rdot" type="radio" value="Cricket" name="rdot">
like image 722
Ali Avatar asked Feb 14 '12 06:02

Ali


People also ask

How do I make radio buttons with text?

To label a radio button, add a <label> element after the <input> element and insert a for attribute with the same value as the id of the associated <input> element. Then, write your label text in the <label> tag.

Can a button type be radio?

The <input type="radio"> defines a radio button. Radio buttons are normally presented in radio groups (a collection of radio buttons describing a set of related options). Only one radio button in a group can be selected at the same time.

What does a radio button return?

The checked property returns True if the radio button is selected and False otherwise. If there are multiple Radio buttons in a webpage, first, all the input tags are fetched and then the values of all the tags that have type as 'radio' and are selected are displayed.

Does Onclick work with radio buttons?

You can select any radio button either by clicking on the label or by clicking on the radio button. Radio button onclick You can trigger an event to know which radio button is checked. For this select all radio buttons and add an onclick event to all button.


1 Answers

Works as defined. To specify radio button text, include it as textual content, preferably using label markup (though this is not formally required):

<input type="radio" id="rdoHalfDay" name="rdoHalfDay" value="Half Day" />
<label for="rdoHalfDay">Half day</label>

Note that the value of the value attribute of a input type="radio" only specifies the data to appear in the form data submitted (and could be anything that you can conveniently handle in your software). It is not supposed to appear and will not normally appear as visible content (except if the form handling software has been written to “echo” it to the user).

like image 157
Jukka K. Korpela Avatar answered Oct 29 '22 02:10

Jukka K. Korpela