2016-08-19 59 views
-4

如果我想更改当前必需之一,我必须写什么jQuery。寻找一个替换p标签和两个p标签的jQuery

电流

jQuery的格式大

(这是一个在线内容)

必需 (下面一个是两线的内容具有不同的字体大小)

jQuery的格式大

jQuery格式小号

+3

电流:你贴quesion还不清楚。要求:请清楚地发布问题。谢谢 –

+1

在发布任何内容之前,请花点时间并正确地制定问题。 – Satpal

回答

0

您可以使用jQuery中的html()方法来设置div的内容。

在这里找到工作示例: https://jsfiddle.net/t11yuvq3/2/

找到下面的代码:

<html> 
    <head> 
    </head> 
    <script src="http://code.jquery.com/jquery-latest.js"></script> 
    <script> 
     $('#btn_click').on('click', function() { 
      $("#container").html("<p id='required1' style='font-size: 125%;'>jQuery Format Big</p><p id='required2' style='font-size: 75%;'>jQuery Format Small</p>"); 
     }); 
    </script> 
    <body> 
     <div id="container"> 
      <p id="current">jQuery Format Normal</p> 
     </div> 
     <button type="button" id="btn_click">Replace p</button> 
    </body> 
</html>