欢迎各位兄弟 发布技术文章
这里的技术是共享的
function doMultiWords(){ | |
var multitext = $('#multitext').val().split("\n"); | |
var container = $(whichmulti).parents('.bg-info').next('ul'); | |
container.find('label').each(function(){ | |
t = $(this).text(); | |
idx = multitext.indexOf(t); | |
if(idx != -1){ | |
multitext.splice(idx, 1); | |
} | |
}); | |
for(var i in multitext){ | |
var clone = $('#cloneitem').clone(); | |
clone.removeClass('hide'); | |
clone.removeAttr('id'); | |
var text = multitext[i]; | |
var html = '<input type="checkbox" checked>' + text; | |
if (text.trim() == '') continue; | |
clone.find('label').html(html); | |
clone.find('label').prop('title', text); | |
clone.find("[class='fa fa-puzzle-piece text-gray']").click(function(){addSuggestion($(this))}); | |
clone.find("[class='fa fa-pencil-square text-gray']").click(function(){editSingleWords($(this))}); | |
clone.find("[class='fa fa-trash text-danger']").click(function(){deleteSingleWords($(this))}); | |
container.prepend(clone); | |
} | |
$('#multiwords').modal('hide'); | |
makesnapshot(); | |
} |