jQuery 面试题

2019-03-16  本文已影响0人  岚平果

选择器

基本选择器
#id
.class
div
*
session1, session2
过滤选择器
:lt(index)
:gt(index)
:eq(index)
:even
:odd
属性选择器
[attribute=value]
表单选择器

 [:input]
 [:text]
 [:password]
 [:radio]
 [:checkbox]
 [:submit]
 [:image]
 [:reset]
 [:button]
 [:file]
$('ul li:lt(3)')

DOM操作

动效

$('div').stop().animate({
  left: '70px'
}, 400)

事件

$('div').bind('mousedown', fn)
$('div').on('mousedown', fn) 
$('div').unbind('mousedown', fn)
$('div').off('mousedown', fn) 
$('ul').on('mousedown', 'li', fn) 
$('div').on('mousedown', fn) 
$('div').trigger('mousedown')
$('div').
. 阻止事件冒泡
e.stopPropagation();
. 阻止事件默认行为
e.preventDefault();
. 获取点击事件的相对浏览器的坐标
e.target.clientX
e.target.clientY

ajax

$.ajax({
  url,
  type,
  data,
  dataType,
  beforeSend,
  success,
  error
})
上一篇下一篇

猜你喜欢

热点阅读