Home > Article > Web Front-end > Detailed introduction to the use of JS control bootstrap suggest plugin
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>
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.
$('#keeperUserName').bsSuggest({ url:ctx+'/fontalUser/find?filter_likes_name=', getDataMethod:'url', effectiveFields:['username','name','phone'], effectiveFieldsAlias:{username:'用户账号',name:'姓名',phone:'手机号'}, showHeader:true, allowNoKeyword:false, multiWord:false, idField:'id', keyField:'name' }).on('onSetSelectValue', function (e, keyword, data) { $('#keeperUser').val(data.id); });
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!