Allow multiple actions in one line, chaining
addClass(), removeClass()
$(document).ready(function(){
});
$(function(){
});
//not include class, element
$('#selectd-plays li:not(.horizontal)').addClass('sub-level');
$('tr:not([th]):even').addClass('even')
//attribute
$('a[@title]')
//element
$('div[ol]')
// ^
$('a[@href^="mailto:"]').addClass('mailto')
//$
$('a[@href$=".pdf"]').addClass('pdflink')
//*
&('a[@href*="mysite.com"]').addClass('mysite')
//js zero-based ; CSS one-based
$('div.horizontal:eq(1)')
$('tr:odd').addClass('odd') = $('tr').filter(':odd').addClass('odd')
$('tr:even').addClass('even')
$('td:contains("Henry")').addClass('highlight')
//contain value
$('th').parent().addClass('table-heading')
$('td:contains("Henry")').next().addClass('highlight')
$('th').siblings().addClass('table-heading')
//拿到DOM Elements
$('#my-element') => jQuery object
$('#my-element').get(0).tagName
沒有留言:
張貼留言