Chrome breakpoint on radio doesn't fire

最后都变了- 提交于 2019-12-24 00:16:54

问题


I have a page where some JavaScript modifies a radio button to be not checked and another to be checked -- the HTML source contains the right checked attributes but when inspecting, the wrong one is checked. Also, when loading with JS off, the right one is checked. So I put a Chrome breakpoint on both for attribute modification and the breakpoints do not fire when reloading. I tried to set a breakpoint on a common parent div and it still doesn't fire.


回答1:


Phil's comment is helpful but it needs just a little love. First, check the Async checkbox

in the Sources tab just next to the Call Stack. Otherwise you won't get a useful call stack. Then add this snippet:

<script>
var debugel  = document.getElementById("edit-field-slideshow-media-type-und-images");
Object.observe(debugel, function(changes) {
  console.log(changes);
  debugger;
});
</script>

Between the console and the debugger you have a reasonable chance to figure out what happens.



来源:https://stackoverflow.com/questions/32685669/chrome-breakpoint-on-radio-doesnt-fire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!