gpt4 book ai didi

javascript - 占位符和组合框中的选择

转载 作者:行者123 更新时间:2023-12-03 11:46:35 25 4
gpt4 key购买 nike

我有以下代码,它输出一个组合框:

<html>
<head>
// Included JS library
</head>
<body>
<script>
$(document).ready(function ()
{
var moduleAutoSuggest = getModuleAutoSuggestOption();

// Create a jqxComboBox
$("#jqxWidget").jqxComboBox(
{
source: moduleAutoSuggest,
placeHolder : "text ...",
width: '250',
height: '25px',
disabled : false,
searchMode: 'containsignorecase',
autoComplete: true
});

obj = '';
$('#jqxWidget').on('select', function (event)
{
var args = event.args;
if (args != undefined) {
var item = event.args.item;
if (item != null)
{
obj = item;
printSelectedValue(obj);
}
}
});
});

function getModuleAutoSuggestOption()
{
var moduleAutoSuggestOption =
[
{"id" : "ALL_ICONS", "label":"All Icons"},
{"id" : "ALL_LOGOS", "label":"All Logos"},
{"id" : "ARTICLE", "label":"Newest Article"},
{"id" : "ARTICLE_SUMMARY", "label":"Headlines For 10 Newest Articles"}
];

return moduleAutoSuggestOption;
}
</script>

<div id='content'></div>
<div id='jqxWidget'>
</div>

</body>
</html>

它给了我一个工作组合框,问题是,placeHolder属性不起作用,如果我单击输入文本,所选值不会变得更清晰

任何帮助将不胜感激

最佳答案

使用您的代码,我创建了一个工作示例,其功能似乎与 jqwidgets 示例 fiddle 相同。 。您是否希望更改此功能?

$(function () 
{
var moduleAutoSuggest = getModuleAutoSuggestOption();

// Create a jqxComboBox
$("#jqxWidget").jqxComboBox({
source: moduleAutoSuggest,
placeHolder: "text ...",
width: '250',
height: '25px',
disabled: false,
searchMode: 'containsignorecase',
autoComplete: true
});

obj = '';
$('#jqxWidget').on('select', function (event){
var args = event.args;
if (args != undefined) {
var item = event.args.item;
if (item != null)
{
obj = item;
printSelectedValue(obj);
}
}
});
});

function getModuleAutoSuggestOption()
{
return [
{"id" : "ALL_ICONS", "label":"All Icons"},
{"id" : "ALL_LOGOS", "label":"All Logos"},
{"id" : "ARTICLE", "label":"Newest Article"},
{"id" : "ARTICLE_SUMMARY", "label":"Headlines For 10 Newest Articles"}
];

}
<link href="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/styles/jqx.base.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxcore.js"></script>
<script src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxscrollbar.js"></script>
<script src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxlistbox.js"></script>
<script src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxbuttons.js"></script>
<script src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxcombobox.js"></script>

<div id='content'></div>
<div id='jqxWidget'>
</div>

关于javascript - 占位符和组合框中的选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26024702/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com