当我使用此代码时,文本输入未显示,并且当我们单击该位置时它很小。我希望输入文本具有正常的智慧,并且输入的标签应该是内联的
html
<!-- Select2 js-->
<script type="text/javascript"
src="http://propeller.in/components/select2/js/select2.full.js">
</script>
<!-- Propeller Select2 -->
<script type="text/javascript"
src="http://propeller.in/components/select2/js/pmd-select2.js"></script
<div class="form-group pmd-textfield pmd-textfield-floating-label">
<label>Keywords/Tags (Type 5 to 20 items) </label>
<select class="select-add-tags form-control pmd-select2-tags" multiple>
<option>Dallas Cowboys</option>
<option>New York Giants</option>
<option>Philadelphia Eagles</option>
<option>Washington Redskins</option>
<option>Chicago Bears</option>
<option>Detroit Lions</option>
<option>Green Bay Packers</option>
<option>Minnesota Vikings</option>
</select>
</div>
的CSS
/* Select2 css */
@import "http://propeller.in/components/select2/css/select2.min.css";
@import "http://propeller.in/components/select2/css/select2-bootstrap.css";
/* Propeller typography */
@import "http://propeller.in/components/typography/css/typography.css";
/* Propeller text fields */
@import "http://propeller.in/components/textfield/css/textfield.css";
/* Propeller select2 */
@import "http://propeller.in/components/select2/css/pmd-select2.css";
/*---header css--*/
js
<!-- Propeller Select2 -->
$(document).ready(function() {
<!-- Select & Add Multiple Tags -->
$(".select-add-tags").select2({
tags: true,
theme: "bootstrap",
})
});
最佳答案
您可以通过将类添加到您的选择并使用CSS设置样式来实现
请检查这个答案
https://stackoverflow.com/a/16519861/7621536
关于javascript - 如何更改select2中输入文本的宽度,并且标签应内联显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44435226/