I’m trying to create an interactive form. Your selections determine the next questions that appear. I’m using jQuery Mobile and it is working fine on the PC using Dreamweaver but when I build to Android the java scripts aren’t working. This seems like simple code so I’m not sure why it’s not working on Android. Can someone tell me where I’m going wrong?
Here’s the code:
Javascript:
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
HTML:
<div id=SkillSet data-role="fieldcontain">
<fieldset data-role="controlgroup" data-type="horizontal">
<legend>Skill Set:</legend>
<a onclick="toggle_visibility('AV');"><input type="checkbox" name="SkillSet" id="SkillSet_0" class="custom" value="" /></a>
<label for="SkillSet_0">AV</label>
<a onclick="toggle_visibility('IT');"><input type="checkbox" name="SkillSet" id="SkillSet_1" class="custom" value="" /></a>
<label for="SkillSet_1">IT</label>
</fieldset>
</div>
<div id="IT" style="display:none">
<hr>
Blah Blah Blah
</div>
This is an interesting one:
Android web DOES support display:none
And javascript
And jQuery mobile isn’t being used
I think it might be because you have an anchor tag around your input. Try putting the onclick event on the checkbox or put something else in the anchor.
EDIT:
Or could it be that there are multiple elements with the same id? Ids are supposed to be unique…