Search

just show me the code

Friday, February 27, 2009

jQuery wrap

the <ul> tag padding act different in ie and firefox. So here is an easy way (using jQuery) to change your classes on the ul to a class on the div.
thanks to this video by Ben Nadel. Here are the slides.
here are more helpful links. 1 2 3 Thanks again Ben Nadel.

here is the style sheet

   21 .ul-indent { padding: 0px 0px 0px 7px; }

here is your tag

   74     <ul class="ul-indent">
   75         <li>First</li>
   77         <li>Second</li>
   79     </ul> 

here is your jquery

   15     <script type="text/javascript">
   16         $(document).ready(function() {
   18             $(".ul-indent").wrap("<div class='ul-indent'></div>").removeClass("ul-indent");
   19         }); 
   36    </script>

No comments:

Post a Comment

Contributors