首页javascriptpjQuery HTML Element - 如何向段落中添加转义文本

jQuery HTML Element - 如何向段落中添加转义文本

我们想知道如何向段落中添加转义文本。


<html>
  <head>
    <script type="text/javascript" src='http://code.jquery.com/jquery-1.5.2.js'></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("p").text("<b>Some</b> new text.");
        });
    </script>
    <style>
      .selected { color:red; }
      .highlight { background:yellow; }
    </style>    
  </head>
  <body>
      <p class="selected highlight">Hello first</p>
      <p class="">Hello</p>
  </body>
</html>