HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Practice HTML</title>
<link rel="stylesheet" href="/Miscellenious/practice.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="/Miscellenious/practice.js"></script>
</head>
<body>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
</ul>
</body>
</html>
JQUERY
//Add list event listener , which will store many list event handler in memory. Not correct way as it requires more memory
// $("li").click(function(){
// $(this).fadeOut();
console.log("call");
// })
//Add Event listener on parent and parameterise the element on which event to be fired. Better way
$("ul").on("click","li",function(){
$(this).fadeOut(400);
console.log("call");
})
});
No comments:
Post a Comment