Created
January 16, 2012 15:41
-
-
Save zanematthew/1621437 to your computer and use it in GitHub Desktop.
Temp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function( $ ){ | |
$("a.toggle_handle").on( "click", function( event ){ | |
event.preventDefault | |
items = $( this ).attr("data-items"); | |
$( "tr." + items ).toggle(); | |
}); | |
$(".item_handle").on("click", function( event ){ | |
taxonomy = $(this).attr('data-taxonomy'); | |
term = $(this).val(); | |
var terms = []; | |
$(':checked').each(function(){ | |
terms.push( $(this).val() ); | |
}); | |
$('tr.'+taxonomy).find('input:first').val( terms ); | |
}); | |
$('.check_all').on('click', 'input:checkbox', function() { | |
$('input.'+$(this).attr('data-taxonomy')).each(function() { | |
taxonomy = $(this).attr('data-taxonomy'); | |
term = $(this).val(); | |
var terms = []; | |
$(':checked').each(function(){ | |
// Don't put out 'check_all', in the array statck | |
if ( $(this).attr('data-key') != 'true' ) { | |
terms.push( $(this).val() ); | |
} | |
}); | |
// Find our first input field and add our terms | |
$('tr.'+taxonomy).find('input:first').val( terms ); | |
$(this).attr('checked', !$(this).attr('checked') ); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment