javascript - jquery display none not working -
gurus, using jquery hide or display fields based on field value options. used hide , show function , working fine, there white space. changed use jquery display none hide fields. doesn't work, please help, thank you! below code.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript"> jquery(document).ready( function(){ hiderating('initial'); } ); function hiderating(scope){ if(scope=='initial'){ jquery('[id$=callsupportbeforeoutput]').style.display = "none"; jquery('[id$=callsupportbeforequestionlabel]').style.display = "none"; } }
jquery('[id$=callsupportbeforeoutput]') return array need provide index change style of elements. see below snippet.
jquery(document).ready( function(){ hiderating('initial'); } ); function hiderating(scope){ if(scope=='initial'){ jquery('[id$=callsupportbeforeoutput]')[0].style.display = "none"; jquery('[id$=callsupportbeforequestionlabel]')[0].style.display = "none";} }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div style="background-color: red"> visible content <div id="callsupportbeforeoutput">main content </div> <div id="callsupportbeforequestionlabel">second content </div> </div>
also mixing pure javascript jquery using style.display. can use .css() jquery method change style if don't want provide index of elements.
wiki
Comments
Post a Comment