stoppropagation

Right click keeps propagating in Firefox

五迷三道 提交于 2019-12-24 01:13:53
问题 I just noticed something unusual. This is what I want to accomplish: I want a div to be shown when I click a link I want the div to disappear when I click somewhere else in the document I don't want it to disappear when I click the div itself Something like this: http://jsfiddle.net/XPmyF/ JS: (function() { var box = $('#box'); $(document).on('click', function() { if (box.css('display') == 'block') { box.css('display', 'none'); } }); $('#start').on('click', function(e) { box.css({ 'text':

jQuery trigger() and stopPropagation() on keydown event

寵の児 提交于 2019-12-23 09:46:48
问题 I am having a difficult time with keydown and stop propagation i do not want my page to refresh, i have tried every which way i can think of, my current code is <script> $(document).ready(function() { var e = jQuery.event( 'keydown', { which: $.ui.keyCode.ENTER } ); $('#id_number').trigger(e, function(event){ event.preventDefault(); event.stopPropagation(); }); }); </script> any idea on what i am doing wrong here? I thought that the event was called correctly, i have jquery and jquery ui

stopPropagation() with tap event

假如想象 提交于 2019-12-21 04:03:05
问题 I'm using hammer.js and it appears that I event.stopPropagation() doesn't work with tap event. If I click on the child, the associated event is triggered but parent's event is also triggered and I don't want that. $('#parent').hammer().bind('tap', function(e) { $(this).css('background', 'red'); });​​​​​​​​ $('#child').hammer().bind('tap', function(e) { e.stopPropagation(); $(this).css('background', 'blue'); }); Here is an example: http://jsfiddle.net/Mt9gV/ ​ I also tried with jGestures and

Chrome not allowing tab prevendefault

爱⌒轻易说出口 提交于 2019-12-20 05:58:50
问题 I have a form on which user can tab and jump to different elements. i was to stop the tab when it reaches a special anchor tag. this is the code which work in firefox $('.next-tab').keypress(function(e){ var code = (e.keyCode ? e.keyCode : e.which); console.log(code); if (code == 0 || code == 9){ console.log("keypress") e.preventDefault(); e.stopPropagation(); } }); but this code does not work in chrome, i dont know why, it does not even enter the keypress method. so i used this code for

Why is event.stopImmediatePropagation() working in all browsers except IE?

余生颓废 提交于 2019-12-20 02:54:23
问题 After some testing I'm noticing that event.stopImmediatePropagation() does not work in IE (per usage below). However, it works in Chrome, FF, Safari, and Opera. What gives? See this fiddle to repro in IE (test fiddle in other browsers to see it work). fiddle javascript: $(function(){ $('#text').focus(function(event){ $('#text').val('Use the button to test this.'); }); $('#button').click(function(event){ // remove all handlers $('#text').off('focus'); // now add this other handler in first

jQuery on() stopPropagation not working?

梦想的初衷 提交于 2019-12-17 15:55:10
问题 I can't seem to get this to stop propagating.. $(document).ready(function(){ $("body").on("click","img.theater",function(event){ event.stopPropagation(); $('.theater-wrapper').show(); }); // This shouldn't fire if I click inside of the div that's inside of the // `.theater-wrapper`, which is called `.theater-container`, anything else it should. $(".theater-wrapper").click(function(event){ $('.theater-wrapper').hide(); }); }); Refer this jsfiddle 回答1: Since you are using on on the body element

How can I make an AngularJS directive to stopPropagation?

妖精的绣舞 提交于 2019-12-17 03:29:29
问题 I am trying to "stopPropagation" to prevent a Twitter Bootstrap navbar dropdown from closing when an element (link) inside an li is clicked. Using this method seems to be the common solution. In Angular, seems like a directive is the place to do this? So I have: // do not close dropdown on click directives.directive('stopPropagation', function () { return { link:function (elm) { $(elm).click(function (event) { event.stopPropagation(); }); } }; }); ... but the method does not belong to element

Nested Lists, jquery, and stopPropagation

[亡魂溺海] 提交于 2019-12-13 21:03:24
问题 I'm running into an issue with nested menus not acting the way I'm anticipating. I've looked through a bunch of stuff on StackOverflow regarding stopPropagation(), but it just doesn't seem to be working. The site is wordpress based, unfortunately, so I don't have direct control of the HTML generated by the menus on the site. The original goal of this project was to add onClick functionality to the menu items, which Wordpress doesn't natively support. That part works - when I click the menus,

How do I close menu on click and when the user clicks away?

心已入冬 提交于 2019-12-13 14:23:24
问题 I have the following code: (function ($) { $(document).ready(function () { $(".clicker_class").click(function () { $('.show_menu_users').show(); }); }); })(jQuery); $('.clicker_class').click(function (e) { e.stopPropagation(); }); I am new to JQuery and a bit puzzled. I was easily able to use the show function but I need to use the close or hide function to close the menu when the user clicks on .clicker_class again and when the user clicks away at something else. I tried using the e

Stop Button Click Event On Directive Angular 2

允我心安 提交于 2019-12-12 19:30:14
问题 I built my app with angular 2 and PrimeNG. I try to use directives on button click for checking user authority. Problem is; if there is no authority, do not continue button click action. But stopPropagation doesn't stop click event. How to stop process if checkAuth() returns false? Blockquote @Directive({ selector: '[checkAuthOnClick]' }) export class CheckAuthorizationOnClickDirective { user: Observable<User>; @Input() allowedClaim: any; observer: MutationObserver; constructor(private