<!--Required jQuery Library File -->
<script src="jquery.min.js"></script>
<p>I am a paragraph element !</p>
<p>I am a paragraph element !</p>
<p>I am a paragraph element !</p>
<p>I am a paragraph element !</p>
<p>I am a paragraph element !</p>
<button onclick="colorAllp()">Click Me</button>
<script>
function colorAllp(){
$("p").not(":last-of-type, :first-of-type").css("color","red");
}
</script>
<br>
<span><b>Comment:</b> Click on button to select and color all 'p
' element except first and last</span>