Home > Web Front-end > JS Tutorial > body text

Detailed introduction to the use of JS control bootstrap suggest plugin

黄舟
Release: 2017-03-25 14:18:01
Original
2907 people have browsed it

This article mainly introduces how to use the JS control bootstrap suggest plugin. It has a certain reference value. Interested friends can refer to it.

This article is shared with everyone. bootstrap-suggest-plugin plug-in, this is a simple editing prompt control for your reference. The specific content is as follows

bootstrap-suggest-plugin plug-in address

The page is as shown below. Using this control

<p class="form-group">
          <label class="col-xs-3 text-right control-label">库管员:</label>
          <p class="col-xs-9">
            <p class="input-group">
              <input type="text" class="form-control no-padding" id="keeperUserName" value="${keeperUserName}" />
              <p class="input-group-btn" style="width:1px;">
                <ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
              </p>
        </p>
    </p>
</p>
Copy after login

js side uses two fields keeperUserName and keeperUser. Among them, keeperUser is the ID used to save user data, because many form forms save the ID of the data in the database, not the data display value.

 $(&#39;#keeperUserName&#39;).bsSuggest({
      url:ctx+&#39;/fontalUser/find?filter_likes_name=&#39;,
      getDataMethod:&#39;url&#39;,
      effectiveFields:[&#39;username&#39;,&#39;name&#39;,&#39;phone&#39;],
      effectiveFieldsAlias:{username:&#39;用户账号&#39;,name:&#39;姓名&#39;,phone:&#39;手机号&#39;},
      showHeader:true,
      allowNoKeyword:false,
      multiWord:false,
      idField:&#39;id&#39;,
      keyField:&#39;name&#39;
    }).on(&#39;onSetSelectValue&#39;, function (e, keyword, data) {
      $(&#39;#keeperUser&#39;).val(data.id);
    });
Copy after login

The above is the detailed content of Detailed introduction to the use of JS control bootstrap suggest plugin. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!