Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgallagher/257724 to your computer and use it in GitHub Desktop.
Save cgallagher/257724 to your computer and use it in GitHub Desktop.
/*
$("#prev ~ sibling) doesnt seem to work in IE7 if the type both the prev and sibling element are of the same type. The examples on jQuery.com dont point this out.
(http://docs.jquery.com/Selectors/siblings#prevsiblings)
below is a workaround.
*/
var items = selectElsAfter(yourSelector);
$(items).each(function()
{
//do something to the selected elements in here... whatever the hell you like!
});
function selectElsAfter(el)
{
var els = []
element = $('#'+el);
var index = ($('*',element.parent()).index(element));
for(i=(index+1);i<$('*', element .parent()).length;i++)
{
els.push($($('*', element.parent()).get(i)));
}
return els;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment