当前位置:首页 > 网页特效 > jQuery特效 >

jQuery添加删除标签插件

时间:2014-05-16 17:33 来源:互联网 作者:源码搜藏 收藏 推荐

  • 广告推荐
效果预览 立即下载

jQuery添加删除标签插件jQuery添加删除标签插件是一款基于jquery开发的标签功能加强插件,可以生成或删除标签,还能对输入重复标签进行检查。jquery添加删除jQuery插件tag标签

<link rel="stylesheet" type="text/css" href="css/jquery.tagsinput.css" />
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/jquery.tagsinput.js"></script>
<script type='text/javascript' src='js/jquery-ui.min.js'></script>
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css" /> 
<script type="text/javascript"> 
function onAddTag(tag) {
alert("Added a tag: " + tag);
}
function onRemoveTag(tag) {
alert("Removed a tag: " + tag);
function onChangeTag(input,tag) {
alert("Changed a tag: " + tag);
}
 
$(function() { 
$('#tags_1').tagsInput({width:'auto'});
$('#tags_2').tagsInput({
width: 'auto',
onChange: function(elem, elem_tags)
{
var languages = ['php','ruby','javascript'];
$('.tag', elem_tags).each(function()
{
if($(this).text().search(new RegExp('\\b(' + languages.join('|') + ')\\b')) >= 0)
$(this).css('background-color', 'yellow');
});
}
});
$('#tags_3').tagsInput({
width: 'auto', 
//autocomplete_url:'test/fake_plaintext_endpoint.html' //jquery.autocomplete (not jquery ui)
autocomplete_url:'test/fake_json_endpoint.html' // jquery ui autocomplete requires a json endpoint
}); 
// Uncomment this line to see the callback functions in action
// $('input.tags').tagsInput({onAddTag:onAddTag,onRemoveTag:onRemoveTag,onChange: onChangeTag});
 
// Uncomment this line to see an input with no interface for adding new tags.
// $('input.tags').tagsInput({interactive:false});
}); 
</script>
本站资源仅限于学习研究,严禁从事商业或者非法活动! 源码搜藏网所有源码来自互联网转载与用户上传分享,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!

jQuery特效下载排行

最新文章