jQuery事件冒泡行为中,阻止页面中span元素的事件冒泡行为,下面代码正确的是
A. $('span').click(function() { console.log('span元素被单击了'); return ;});
B. $('span').click(function() { console.log('span元素被单击了'); false;});
C. $('span').click(function() { console.log('span元素被单击了'); return false;});
D. $('span').click(function() { console.log('span元素被单击了'); stop;});
查看答案
下面代码中,给input框添加获取焦点事件并在事件处理函数中给input框添加背景色的是
A. $("input").focus(function(){ $(this).css("border","1px solid red") })
B. $("input").focus(function(){ $(this).css("background-color","red") })
C. $("input").blur(function(){ $(this).css("bacground-color","red") })
D. $("button").onfocus(function(){ $(this).css("background-color","red") })
jQuery中同一个事件处理函数来处理多个事件,可以使用()属性来获取事件类型。
A. pageX/Y
B. target
C. keyCode
D. type
jQuery中,能够实现当鼠标单击class值为comment下的里元素时设置属性“light=on”的代码是
A. $('.comment>li').mouseover(function() {$(this).attr('light', 'on')});
B. $('.comment>li').click(function() {$(this).attr('light', 'on')});
C. $('.comment>li').click(function() {$(this).css('light', 'on')});
D. $('.comment>li').click(function() {$(this).attribute('light', 'on')});
jQuery事件冒泡中,阻止事件冒泡的方式中,event.stopPropagation()可以用( )语句来替换。
A. stop()
B. offPropagation()
C. return false
D. return