I have two two <p> and one <div> and want event handler to display a message when the first <p> is pressed. How can I pull that off?
$("#menu:first-child").on('click', 'p', pullInput);
function pullInput() {
console.log("da");
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="menu">
<p id="newCategoryButton">New category</p>
<p>New Song</p>
</div>
newCategoryButton?$("#menu").on('click','#newCategoryButton',pullInput);?$("#newCategoryButton").on("click", pullInput );