0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【javascript】【jquery】autocomplete(オートコンプリート)の複数セレクタを判定する

Posted at

コード

<input type="text" name="chara_name" value="" >
<input type="text" name="skill_name1" data-type="skill" value="" >
<input type="text" name="skill_name2" data-type="skill" value="" >
<input type="text" name="skill_name3" data-type="skill" value="" >
    area.find('セレクタ1,セレクタ2').autocomplete({
        source: function(request, response) {
            const text = request.term;
            const hit_list = [];
            if(this.element.attr('name') === 'chara_name'){
                処理
            }
            if(this.element.data('type') === 'skill') {
                処理
            }
            response(hit_list);
        },
        autoFocus: true,
        delay: 200,
        minLength: 2
    });

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?