Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
How do i disable all the links in my slider panes using jquery?
Basically every single <a href... within my parent div
<a href...
$('.classname-of-parent-div').on('click', 'a', function (e) { e.preventDefault(); });
试试看。
$(document).ready(function() { $("#slider").on('click', 'a', function(event) { event.preventDefault(); alert('no navigation'); }); });
现场演示 更多关于 jQuery PreventDefault的信息在这里
//You could alse use $('a') if you want to disable ALL links $('.sliding-pane a').click(function(e) { e.preventDefault(); });