Skip to content

Commit

Permalink
Update demos to show add/remove/clear
Browse files Browse the repository at this point in the history
  • Loading branch information
loopj committed Jun 12, 2011
1 parent ef39cc5 commit b29eedc
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,36 @@ <h2 id="onadd-ondelete">Using onAdd and onDelete Callbacks</h2>
});
</script>
</div>


<h2 id="plugin-methods">Using the add, remove and clear Methods</h2>
<div>
<a href="#" id="plugin-methods-add">Add Token</a> | <a href="#" id="plugin-methods-remove">Remove Token</a> | <a href="#" id="plugin-methods-clear">Clear Tokens</a><br />
<input type="text" id="demo-input-plugin-methods" name="blah" />
<input type="button" value="Submit" />
<script type="text/javascript">
$(document).ready(function() {
$("#demo-input-plugin-methods").tokenInput("http://shell.loopj.com/tokeninput/tvshows.php");

// Add a token programatically
$("#plugin-methods-add").click(function () {
$("#demo-input-plugin-methods").tokenInput("add", {id: 999, name: "James was here"});
return false;
});

// Remove a token programatically
$("#plugin-methods-remove").click(function () {
$("#demo-input-plugin-methods").tokenInput("remove", {name: "James was here"});
return false;
});

// Clear all tokens
$("#plugin-methods-clear").click(function () {
$("#demo-input-plugin-methods").tokenInput("clear");
return false;
});
});
</script>
</div>
</body>
</html>

0 comments on commit b29eedc

Please sign in to comment.