Skip to content

Instantly share code, notes, and snippets.

@webflo
Created September 27, 2014 10:09
Show Gist options
  • Save webflo/21ce7a95af3ab10dad1e to your computer and use it in GitHub Desktop.
Save webflo/21ce7a95af3ab10dad1e to your computer and use it in GitHub Desktop.
Tag it!
var tags = jQuery('#edit-taxonomy-vocabulary-9-und').val();
tags = jQuery.map(tags.split(', '), jQuery.trim);
if (jQuery.inArray('Amsterdram2014', tags) === -1) {
jQuery('#edit-taxonomy-vocabulary-9-und').val(jQuery('#edit-taxonomy-vocabulary-9-und').val() + ', Amsterdram2014');
}
<p><em>You did it!</em>&nbsp; You can run your bookmarklet by clicking: <a class="bookmarklet" href="javascript:(function()%7Bvar%20tags%20%3D%20jQuery('%23edit-taxonomy-vocabulary-9-und').val()%3Btags%20%3D%20jQuery.map(tags.split('%2C%20')%2C%20jQuery.trim)%3Bif%20(jQuery.inArray('Amsterdram2014'%2C%20tags)%20%3D%3D%3D%20-1)%20%7BjQuery('%23edit-taxonomy-vocabulary-9-und').val(jQuery('%23edit-taxonomy-vocabulary-9-und').val()%20%2B%20'%2C%20Amsterdram2014')%3B%7D%7D)()">this link</a><br><br>and here is the code:</p>
// Source: http://mrcoles.com/bookmarklet/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment