jQuery(document).ready(function() { function do_zebra(){ jQuery('.form-table tr:nth-child(4n+3)').css({"background" : "#F1F1F1"}); jQuery('.form-table tr:nth-child(4n+4)').css({"background" : "#F1F1F1"}); jQuery('.form-table tr:last-child').css({"background" : "white"}); } do_zebra(); jQuery('#condition-add-new').click(function(){ //count rows in a .form-table minus last row with the button var num_rows = jQuery('.form-table tr').length; //devide by 2 to get number of sets => name and code fields. var sets = (num_rows - 1)/2; //var row1 = jQuery('.form-table tr:eq(0)').html(); //var row2 = jQuery('.form-table tr:eq(1)').html(); var rows = ' '; //jQuery(this).parent().parent().before('' + row1.replace('[0]', '['+sets+']') + '' + '' + row2.replace('[0]', '['+sets+']') + ''); jQuery(this).parent().parent().before(rows.replace(/%id/gi, sets).replace(/%n/gi, sets+1)); do_zebra(); }); function blink(target) { if(jQuery(target).attr('title')){ //"border" : "1px solid #EE6A50", "border-top" : "none" jQuery(target).css({"background-color" : "#EECBAD", "-webkit-box-shadow" : "0px 1px 3px #000", "-moz-box-shadow" : "0px 1px 3px #000", "box-shadow" : "0px 1px 3px #000"}); jQuery(target).removeAttr('title'); }else{ jQuery(target).css({"background-color" : "#E3E3E3", "border" : "none", "-webkit-box-shadow" : "none", "-moz-box-shadow" : "none", "box-shadow" : "none"}); jQuery(target).attr('title', 'atw'); } // Set it back to old color after 500 ms setTimeout(function() { blink(target); }, 200); } blink("#contextual-help-link-wrap"); });