Skip to content

Instantly share code, notes, and snippets.

@oshanz
Last active August 29, 2015 14:04
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 oshanz/e93b0c04a4f31e981ad0 to your computer and use it in GitHub Desktop.
Save oshanz/e93b0c04a4f31e981ad0 to your computer and use it in GitHub Desktop.
javascript table Expand row
(function($){
$.fn.jExpand = function(){
var element = this;
$(element).find("tr:odd").addClass("odd");
$(element).find("tr:not(.odd)").hide();
$(element).find("tr:first-child").show();
$(element).find("tr.odd").click(function() {
$(this).next("tr").toggle();
$(this).find(".arrow").toggleClass("up");
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment