Hızlı yanıt: kod örneği
stackoverflow.com whats-the-difference-between-event-stoppropagation-and-event-preventdefault
stopPropagation
preventDefault
$("#but").click(function (event) { event.preventDefault()})$("#foo").click(function () { alert("parent click event fired!")})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><div id="foo"> <button id="but">button</button></div>
$("#but").click(function (event) { event.stopPropagation()})$("#foo").click(function () { alert("parent click event fired!")})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><div id="foo"> <button id="but">button</button></div>
stopPropagation
button
div
preventDefault
event.cancelBubble
event.preventDefault()
event.returnValue
event.stopPropagation()
stopPropagation
cancelBubble
preventDefault
returnValue