【发布时间】:2016-10-27 09:13:54
【问题描述】:
是否可以在任何浏览器上使用控制台找到当前事件的 javascript 代码?
例如,请参阅this JSFiddle。这是对应的代码:
.close-icon {
border:1px solid transparent;
background-color: transparent;
display: inline-block;
vertical-align: middle;
outline: 0;
cursor: pointer;
}
.close-icon:after {
content: "X";
display: block;
width: 15px;
height: 15px;
/*position: absolute;*/
float:right;
background-color: #FA9595;
z-index:1;
right: 35px;
top: 0;
bottom: 0;
margin: auto;
padding: 2px;
border-radius: 50%;
text-align: center;
color: white;
font-weight: normal;
font-size: 12px;
box-shadow: 0 0 2px #E50F0F;
cursor: pointer;
}
<input type="range" min="12" max="120" id="slider" />
<div class="text" contenteditable="true" style="cursor:grab;">hello1<button class="close-icon dbutton" type="reset"/></div>
<div class="text text1" contenteditable="true" style="cursor:grab;">hello2<button class="close-icon dbutton1" type="reset"/></div>
<div class="text text2" contenteditable="true" style="cursor:grab;">hello3<button class="close-icon dbutton2" type="reset"/></div>
<div class="text text3" contenteditable="true" style="cursor:grab;">hello4<button class="close-icon dbutton3" type="reset"/></div>
$("#slider").on("change",function(){
var v=$(this).val();
$('.text.active').css('font-size', v + 'px');
});
$('.text').on('focus',function(){
$('.text').removeClass('active');
$(this).addClass('active');
});
$(document).on("click",".close-icon",function(){
$(this).closest('div').remove();
//alert('hiii');
});
这里我写代码放大文字并关闭div。现在,当我调整文本大小时,是否可以看到负责调整文本大小的代码?
更新:我知道如何检查元素、更改样式和其他内容 .但在这里我想知道如何检测 javascript 代码或 当前事件的功能。嗨,这与控制台.log无关 功能 。我已经知道了。我在问如何知道哪个 当我单击关闭按钮时功能正在工作,我怎么能看到 浏览器中的代码。我在这里写代码,我明白代码在哪里 是 。如果其他人编写代码并且我正在寻找浏览器怎么办 用于检测正在运行的代码和事件
【问题讨论】:
-
firebug 插件和使用断点
标签: javascript jquery html google-chrome firefox