From our sponsor: Chromatic - Visual testing for Storybook, Playwright & Cypress. Catch UI bugs before your users do.
$('#target div:not(#exclude)').hide(); //or $('#target').children().filter(':not(#exclude)').hide();
$('element').bind('resize', function(){ alert( 'Height changed to' + $(this).height() ); }
$('someTableSelector').find('tr:gt(0)').remove();
1 level: $('*:not(* *)'); 2 level: $('*:not(* *)').find('> *'); 3 level: $('*:not(* *)').find('> * > *');
Tiny break: 📬 Want to stay up to date with frontend and trends in web design? Subscribe and get our Collective newsletter twice a tweek.
var foundin = $('*:contains("some string bla bla")');
alert($(document).scrollTop());
$('* :not(.someclass)')
$('#myTable tr:last').after('<tr>...</tr>');
num = num.toString(16); reverse process: num = parseInt(num, 16);
var elements = $('#someid input[type=sometype][value=somevalue]').get();
var date = new Date(); date.setTime(date.getTime() + (x * 60 * 1000)); $.cookie('example', 'foo', { expires: date });
example: first 10 anchors $('a').slice(0,10); //or $('a:lt(10)');
//Get the value of a selected option $('selectElement').val(); //Get the text of a selected option $('#selectElementId :selected').text(); //Remove an option (e.g. id=1) $("#selectElementId option[value='1']").remove();
Pingback: Some Useful JavaScript & jQuery Snippets - Part 2 | Codrops
Pingback: Some Useful JavaScript & jQuery Snippets | Codrops
Definitely some useful JavaScript and jQuery scripts man. I can probably even use a few on my blog, great!
Great and usefull!!
thanks!
Pingback: Some Useful JavaScript & jQuery Snippets – Part 3 | Codrops