↓ Skip to main content
  1. Posts/

Automating data entry in the development console

·
Rubén Infante Docio
Author
Rubén Infante Docio
Software engineer

Due to the vicissitudes of fate, sometimes we have to fill a website with content by hand, having a “resource file” (not importable).

Imagine that you want to introduce the tags of posts or videos on a website.

Tag controls usually identify each tag, with separators by character, by key, or focus. This is the case of tag-it, a Jquery plugin, easy to implement and very useful. Available at the following url.

http://aehlke.github.io/tag-it/

Well, to be able to pass a text string and fill in the tags with it we can use the following function:

var ori = "cadena;con;los;tags;que;se;utilizarán";
var str = ori.split(";");
var inputTemp = $('.tagit-new .ui-widget-content');
var auto = function () {
    for (var i = 0; i < str.length; i++) {
        inputTemp.focus();
        inputTemp.val(str[i]);
        inputTemp.blur();
    }
};
auto();

Related