<!DOCTYPE HTML>
<
html
>
<
head
>
<
title
>
Not class selector in jQuery.
</
title
>
<
script
src
=
</
script
>
</
head
>
<
body
style
=
"text-align:center;"
>
<
h1
id
=
"h"
style
=
"color:green;"
>
GeeksForGeeks
</
h1
>
<
p
id
=
"GFG"
style
=
"font-size: 15px; font-weight: bold;"
>
click on button to change the text content
of all classes except GFG-1
</
p
>
<
p
class
=
"GFG-1"
style
=
"font-size: 15px; font-weight: bold;"
>
GFG-1
</
p
>
<
p
class
=
"GFG-2"
style
=
"font-size: 15px; font-weight: bold;"
>
GFG-2
</
p
>
<
p
class
=
"GFG-3"
style
=
"font-size: 15px; font-weight: bold;"
>
GFG-3
</
p
>
<
button
id
=
"button"
>
Click here
</
button
>
<
p
class
=
"GFG"
style
=
"color:green; font-size: 20px; font-weight: bold;"
>
</
p
>
<
script
>
$("button").on('click', function() {
$('p[class^="GFG-"]').not('.GFG-1').text("new Content");
$(".GFG").text("Text content changed")
});
</
script
>
</
body
>
</
html
>