ITeye博客

jquery

共 1 篇文章

转:jquery选择器大全

一、基本选择器 1. id选择器(指定id元素) 将id="one"的元素背景色设置为黑色。(id选择器返单个元素) $(document).ready(function () { $('#one').css('background', '#000'); }); 2. class选择器(遍历css类元素) 将class="cube"的元素背景色设为黑色 $(document).ready(function () { $('.cube').css('background', '#000'); }); 3. element选择器(遍历html元素) 将p元素的文字大小设置为12px $(docu…

2014-11-27 09:50 · jquery · jQuery · 选择器