In the following div:-
<div>
My Text that needs to be hidden
<span style="font-size: 21px">Other text Other things</span>
</div>
I just want to hide the text My Text that needs to be hidden
. Is it possible?
In the following div:-
<div>
My Text that needs to be hidden
<span style="font-size: 21px">Other text Other things</span>
</div>
I just want to hide the text My Text that needs to be hidden
. Is it possible?
Html:
<div>
<span id="mySpan" >My Text that needs to be hidden</span> // Add a span with a id
<span style="font-size: 21px">Other text Other things</span>
</div>
JQuery:
$(document).ready(function(){
$('#mySpan').css('display', 'none');
});
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide("slow",function(){
alert("The paragraph is now hidden");
});
});
});
</script>
</head>
<body>
<button>Hide</button>
<div>
<p>My Text that needs to be hidden </p>
<span style="font-size: 21px">Other text Other things</span>
</div>
</body>
</html>