JavaScript CSS styling not working in IE, it is working in Chrome and Mozilla.
This is my code:
document.ready=function() {
var val = document.getElementById("registration_select").value;
if(val =="Relay - Ultra, Standard and Sprint distances (Men / Women/ Mixed) - open to all Age-Groups & Juniors above 16"){
document.getElementById("register_right").style.display="block";
}
else{
document.getElementById("register_right").style.display="none";
}
registration_select.onchange=function(){
var val = document.getElementById("registration_select").value;
if(val =="Relay - Ultra, Standard and Sprint distances (Men / Women/ Mixed) - open to all Age-Groups & Juniors above 16"){
document.getElementById("register_right").style.display="block";
}
else{
document.getElementById("register_right").style.display="none";
}
}
};
This is my HTML
<select id="registration_select" name="Category">
<option value="category1">category1</option>
<option value="Relay - Ultra, Standard and Sprint distances (Men / Women/ Mixed) - open to all Age-Groups & Juniors above 16">Relay - Ultra, Standard and Sprint distances (Men / Women/ Mixed) - open to all Age-Groups & Juniors above 16</option>
</select>
<div id="register_right">
<h3>Team Mate Profile</h3>
</div>
And this is my CSS
#register_right{float:right; display:none; width:49%;}
Please Help.
Try this
jQuery(function($) {
var val = document.getElementById("registration_select").value;
if(val =="Relay - Ultra, Standard and Sprint distances (Men / Women/ Mixed) - open to all Age-Groups & Juniors above 16"){
document.getElementById("register_right").style.display="block";
}
else{
document.getElementById("register_right").style.display="none";
}
document.getElementById("registration_select").onchange=function(){
var val = document.getElementById("registration_select").value;
if(val =="Relay - Ultra, Standard and Sprint distances (Men / Women/ Mixed) - open to all Age-Groups & Juniors above 16"){
document.getElementById("register_right").style.display="block";
}
else{
document.getElementById("register_right").style.display="none";
}
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.