jQuery IE6 & IE7 Pseudo-Selector Workaround


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //instead of this CSS:
  2. #box:after {stuff}
  3. #box:before {stuff}
  4.  
  5. //do this with jQuery
  6. $(document).ready(function() {
  7. if ($.browser.msie && $.browser.version <= 7) {
  8. $("#box").after("stuff after");
  9. $("#box").before("stuff before");
  10. }
  11. });
  12.  
  13. //or
  14.  
  15. $(document).ready(function() {
  16. if ($.browser.msie && $.browser.version <= 7) {
  17. $("#box").insertAfter("stuff after");
  18. $("#box").insertBefore("stuff before");
  19. }
  20. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.