Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.53 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do I confer CSS properties upon elements retrieved from $.ajax()?
  2. <script type="text/javascript">
  3.     $(function() {
  4.         $.ajax({
  5.             url: '/getInfo',
  6.             context: $('#contentBox'),
  7.             success: function(data) {
  8.                 $(this).html(data);
  9.             }
  10.         });
  11.     });
  12.  
  13.  </script>
  14.  
  15.  <style type="text/css">
  16.      #makeMeRed {color: red !important;}
  17.  </style>
  18.  
  19.  <div id="contentBox"></div>
  20.        
  21. <p id="makeMeRed">I'm supposed to be red.</p>
  22.        
  23. <style="text/css">
  24.        
  25. <style type="text/css">