0% found this document useful (0 votes)
41 views2 pages

This Is A Paragraph Inside A Div Element. This Is A Paragraph

The document contains code for two webpages. The first selects all paragraphs inside a div and sets their background color to pink when clicked. The second displays an alert pop-up saying "The text has been changed" whenever the text inside the input field is changed by typing or clicking outside the field.

Uploaded by

Abdul Gafur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views2 pages

This Is A Paragraph Inside A Div Element. This Is A Paragraph

The document contains code for two webpages. The first selects all paragraphs inside a div and sets their background color to pink when clicked. The second displays an alert pop-up saying "The text has been changed" whenever the text inside the input field is changed by typing or clicking outside the field.

Uploaded by

Abdul Gafur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

<!

DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("div").delegate("p","click",function(){
$("p").css("background-color","pink");
});
});
</script>
</head>
<body>

<div style="background-color:yellow">
<p>This is a paragraph inside a div element.</p>
</div>
<p>This is a paragraph.</p>

</body>
</html>

This is a paragraph inside a div element.
This is a paragraph.

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input").change(function(){
alert("The text has been changed.");
});
});
</script>
</head>
<body>

<input type="text">
<p>Write something in the input field, and then press enter or click outside the field.</p>

</body>
</html>

You might also like