mirror of
https://github.com/wahyd4/jQuery-Tags-Input.git
synced 2026-08-09 12:56:35 +10:00
73 lines
2.5 KiB
HTML
73 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>jQuery Tags Input Test Page</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link rel="stylesheet" type="text/css" href="jquery.tagsinput.css" />
|
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
|
|
<script type="text/javascript" src="jquery.tagsinput.js"></script>
|
|
<!-- To test using the original jQuery.autocomplete, uncomment the following -->
|
|
<!--
|
|
<script type='text/javascript' src='http://xoxco.com/x/tagsinput/jquery-autocomplete/jquery.autocomplete.min.js'></script>
|
|
<link rel="stylesheet" type="text/css" href="http://xoxco.com/x/tagsinput/jquery-autocomplete/jquery.autocomplete.css" />
|
|
-->
|
|
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js'></script>
|
|
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/start/jquery-ui.css" />
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function onAddTag(tag) {
|
|
alert("Added a tag: " + tag);
|
|
}
|
|
function onRemoveTag(tag) {
|
|
alert("Removed a tag: " + tag);
|
|
}
|
|
|
|
$(function() {
|
|
$('#tags_1').tagsInput();
|
|
$('#tags_2').tagsInput({
|
|
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({
|
|
//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});
|
|
|
|
// Uncomment this line to see an input with no interface for adding new tags.
|
|
// $('input.tags').tagsInput({interactive:false});
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<header>
|
|
jQuery Tags Input!
|
|
</header>
|
|
<section>
|
|
<form>
|
|
<input id="tags_1" type="text" class="tags" value="foo,bar,baz,roffle" />
|
|
|
|
<label>Technologies: (Programming languages in yellow)</label>
|
|
<input id="tags_2" type="text" class="tags" value="php,ios,javascript,ruby,android,kindle" />
|
|
|
|
<label>Autocomplete:</label>
|
|
<input id='tags_3' type='text' class='tags'>
|
|
|
|
</form>
|
|
</section>
|
|
|
|
</body> |