隐藏<h4>中的文字

时间:2016-09-15 06:10:42

标签: text hide

我也需要帮助,删除或隐藏此文本

<h4> I want hide this text </h4>

我试试这个,但这不起作用:

$( "h4" ).hide();

2 个答案:

答案 0 :(得分:0)

$( document ).ready(function() {

$("#hideBtn").click(function(){
    $('h4').hide();
});
  
$("#showBtn").click(function(){
    $('h4').show();
});

$("#remBtn").click(function(){
    $('h4').remove();
});

});
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
</head>
<body>
<button id='hideBtn'>Click to Hide H4 </button>
<button id='showBtn'>Show to Hide H4 </button>
<button id='remBtn'>Remove Permanent</button>

<h4>H4 content for hide and show </h4>
  
  </body>
  </html>

$( document ).ready(function() {
    $("h4").hide();
});

答案 1 :(得分:0)

&#13;
&#13;
<html>
<head>
<title>Title of the document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>


 <script>
   	$(document).ready(function(){
			$("h4").hide();
});
</script>
  
</head>
<body>
	<h4>I want to hide</h4>
	<h5>Test</h5>
</body>
</html>
&#13;
&#13;
&#13;

       <html>
        <head>
        <title>Title of the document</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
    $(document).ready(function(){
    $("h4").hide();
   });
</script>
    </head>
    <body>
        <h4>I want to hide</h4>
         <h5>Test</h5>
    </body>
    </html>