Skip to content
This repository

YQLAutoTagger is a script that analyses the text of a form field, runs it through the Yahoo term extractor and populates another field with the found keywords as tags. To use it all you need to do is include the script in the page and call the init() function with the IDs of the field you want to analyse and the one you want to seed.

Usage

<div>
  <label for="mainfield">Your Message:</label>
  <textarea id="mainfield" name="mainfield">Hello I am a programmer that does care about interfaces. What kind of library can I use that gives me a defined set of widgets that have been tested in the real world?</textarea>
</div>
<div>
  <label for="tags">Tags:</label>
  <input type="text" id="tags" name="tags">
</div>

<script type="text/javascript" src="http://github.com/codepo8/YQLAutoTagger/raw/master/YQLAutoTagger.js">
</script>
<script type="text/javascript">
YQLAutoTagger.init('mainfield','tags');
</script>

YQLAutoTagger automatically checks the field when the user moves away from it – the blur event gets fired – adds a class called loading to the original field and disables the tag field while the lookup is happening. It also adds quotation marks around tags that contain spaces.

You can change this behaviour by overwriting the configuration of YQLAutoTagger before you call the init() method.

<script type="text/javascript" src="http://github.com/codepo8/YQLAutoTagger/raw/master/YQLAutoTagger.js">
</script>
<script type="text/javascript">
YQLAutoTagger.config.tagDelimiter = ',';
YQLAutoTagger.config.loadingClass = 'waiting';
YQLAutoTagger.init('mainfield','tags');
</script>

Configuration options

The configuration options available to you are:

  • loadingClass – the class added to the field while the analysis is happening (defaults to ‘loading’)
  • tagDelimiter – the string added in between tags (default is a space)
  • addQuotes – Boolean to add quotes around tags that contain spaces (set to true)
  • disableField – Boolean to disable the tags field while analysing (set to true)
Something went wrong with that request. Please try again.