Skip to content

Instantly share code, notes, and snippets.

@tsvetkovpro
Last active July 27, 2018 17:00
Show Gist options
  • Save tsvetkovpro/28a74fb71722c1ddb1d3c3467e2518cc to your computer and use it in GitHub Desktop.
Save tsvetkovpro/28a74fb71722c1ddb1d3c3467e2518cc to your computer and use it in GitHub Desktop.
jQuery
$('div'); // all div
$('#id_name'); // element id="id_name"
$('.class_name'); // element class="class_name"
$('div#id_name'); // all div's with did_name"
$('div.class_name'); // all div's with class="class_name
$('div h1'); // all h1 in div
$('#id_name .test'); // all element with class="test" in element with id="id_name"
$('.class_name, .test'); // all element with class="class_name" and with class="test"
$('*'); // all elements
$('div *'); // all elements on all div's
$('div > h1'); // all h1 elements in elements div, where h1 direct children div
$('div > *'); и $('div').children(); // all childs div
$('div').parent(); // all parents div
$('* > div'); и $('div').parents(); // all parents div
$('div').parents('h1'); // all parents h1, element div
// in method parents() use any selector.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment