Applying styles from CSS to newly appended elements

后端 未结 3 717
太阳男子
太阳男子 2021-01-04 19:13

I add an element to a parent div dynamically.

$(\'.some_div\').append(\"
  • hey!
  • \")

    In my CSS,

    
    
            
    3条回答
    •  庸人自扰
      2021-01-04 19:49

      Try this

      $('.some_div').append('
    • hey!
    • ')

      If you want to apply specific css for this element

      $('.some_div').append('
    • hey!
    • ')

      If you want to apply CSS based on class

      $('.hi').css("color","white");
      

    提交回复
    热议问题