Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
80
rated 0 times [  87] [ 7]  / answers: 1 / hits: 20334  / 9 Years ago, mon, may 25, 2015, 12:00:00

I have 3 div which are:



<div class=widgetbox id=divone>Content 1</div>



<div class=widgetbox id=divtwo>Content 2</div>



<div class=widgetbox id=divthree>Content 3</div>



I need to hide two of these div so that I can make a condition to decide which to appear and which to hide later on. I tried to hide it like below, but it doesn't work. I think I'm using mvc 4. sorry for bad english.



<script type='text/javascript'>
$(#divtwo).hide();
$(#divthree).hide();
</script>

More From » asp.net

 Answers
251

Here you get two answers:



1)



<script type='text/javascript'>
$(document).ready(function(){
$(#divtwo).hide();
$(#divthree).hide();
});
</script>


2) try this one. No need any references.



<script type='text/javascript'>
window.onload=function(){
document.getElementById(divtwo).style.display='none';
document.getElementById(divthree).style.display='none';
}
</script>

[#66483] Thursday, May 21, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
loganl

Total Points: 424
Total Questions: 86
Total Answers: 112

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
;