function showcode(code){ jQuery('#'+code).toggle(); } jQuery(document).ready( function () { jQuery('.show_hide').click( function () { var rel = jQuery(this).attr('rel'); console.log(jQuery('#'+rel+':visible').length); jQuery('#'+rel).toggle(); if(jQuery('#'+rel+':visible').length == 1){ jQuery(this).text('Hide'); jQuery('#opendc_hidden_'+rel).val('1'); } else { jQuery(this).text('Show'); jQuery('#opendc_hidden_'+rel).val('0'); } }); }); jQuery(document).ready( function (){ jQuery('#add_social_link').click( function (){ var new_one = jQuery('.new_one_social').length; if(new_one < 19) { if(new_one !=0) { for(var i=1;i<20;i++){ var check_id = jQuery('#table_social #opendc_social_custom_'+i+' ').attr('data-id'); //console.log(check_id); if(check_id == undefined || check_id == "") { data_id = i; break; } } console.log(data_id); var add_new = '