Hello,
I would like to ask for a little help here, since I haven't got any big knowledge in Javascript, nor in jQuery. I need to show 5 radio buttons when a checkbox is checked, the checkboxes represent languages that the user speaks, so for each of the selected, there should appear 5 separate radio buttons for how good they speak it(1 to 5). I tried to do it with jQuery, but I did not manage to get very far away...
This is where my checkboxes are created(dynamically):
<% for(int i = 0; i < Model.Languages.Count; i++)
{ %>
<input id="applang" name="applang" type="checkbox" value="<%: Model.Languages[i].languageID%>" />
<%: Model.Languages[i].name.ToString() %><br />
<%} %>
So, I tried to add this script, but it's not working:
<script type="text/javascript">
$("input[@name='applang']").click(function () {
$("input[type='radio']").show();
});
I also tried this way - to use this javascript:
<script type="text/javascript">
function toggle_visibility(id) {
var e = document.getElementById(id);
if (e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
And it works, but it works on already present controls, and I guess I need to create mine dynamically, or maybe not? And I tried to hide a present control with CSS, but then when the script shows it, it is there, only invisible :)
Also, I would want to get the name and value of the radio buttons from my database, i.e. Model(this is ASP.NET MVC).. Can someone help me a little bit, please?