告诉我,重新加载页面后是否可以重用输入字段的值?那些。什么样的缓存(cookie)字段(输入)?这样在重新加载后,在字段中输入值的用户将再次在字段的同一字段中看到相同的值。对此实施有什么想法吗?
Fox's questions
有这样一个例子,我做了一个搜索,只滚动到需要的地方,因为树很大,告诉我如何最好地实现它?
$(function () {
$('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch');
$('.tree li.parent_li > span').on('click', function (e) {
var children = $(this).parent('li.parent_li').find(' > ul > li');
if (children.is(":visible")) {
children.hide('fast');
$(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
} else {
children.show('fast');
$(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
}
e.stopPropagation();
});
});
$(function(){
$('#search').on('keyup', function (){
var val = $(this).val().toLowerCase()
if (val) {
$('ul li span').each(function(idx, obj){
if ($(obj).text().toLowerCase().indexOf(val) !== -1)
$(obj).addClass('highlight')
else
$(obj).removeClass('highlight')
})
}
else
$('ul li span').removeClass('highlight')
})
})
.tree {
min-height:20px;
padding:19px;
margin-bottom:20px;
background-color:#fbfbfb;
border:1px solid #999;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px;
-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05)
}
.tree li {
list-style-type:none;
margin:0;
padding:10px 5px 0 5px;
position:relative
}
.tree li::before, .tree li::after {
content:'';
left:-20px;
position:absolute;
right:auto
}
.tree li::before {
border-left:1px solid #999;
bottom:50px;
height:100%;
top:0;
width:1px
}
.tree li::after {
border-top:1px solid #999;
height:20px;
top:25px;
width:25px
}
.tree li span {
-moz-border-radius:5px;
-webkit-border-radius:5px;
border:1px solid #999;
border-radius:5px;
display:inline-block;
padding:3px 8px;
text-decoration:none
}
.tree li.parent_li>span {
cursor:pointer
}
.tree>ul>li::before, .tree>ul>li::after {
border:0
}
.tree li:last-child::before {
height:30px
}
.tree li.parent_li>span:hover, .tree li.parent_li>span:hover+ul li span {
background:#eee;
border:1px solid #94a0b4;
color:#000
}
.highlight {
background: red;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css" rel="stylesheet"/>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet"/>
<input title="search" name="Name" id="search" type="text" placeholder="search">
<div class="tree well">
<ul>
<li>
<span><i class="icon-folder-open"></i> Theme</span> <a href="">href</a>
<ul>
<li>
<span><i class="icon-minus-sign"></i> Standard</span> <a href=""></a>
<ul>
<li>
<span><i class="icon-leaf"></i> Grand Child</span> <a href="">href</a>
</li>
</ul>
</li>
<li>
<span><i class="icon-minus-sign"></i> Child</span> <a href=""></a>
<ul>
<li>
<span><i class="icon-leaf"></i> Grand Child</span> <a href=""></a>
</li>
<li>
<span><i class="icon-minus-sign"></i> Grand Child</span> <a href="">href
<li>
<span><i class="icon-minus-sign"></i> Great Grand Child</span> <a href=""></a>
<ul>
<li>
<span><i class="icon-leaf"></i> Great great Grand Child</span> <a href=""></a>
</li>
<li>
<span><i class="icon-leaf"></i> Great great Grand Child</span> <a href=""></a>
</li>
</ul>
</li>
<li>
<span><i class="icon-leaf"></i> Great Grand Child</span> <a href=""></a>
</li>
<li>
<span><i class="icon-leaf"></i> Great Grand Child</span> <a href=""></a>
</li>
</ul>
</li>
<li>
<span><i class="icon-leaf"></i> Grand Child</span> <a href=""></a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<span><i class="icon-folder-open"></i> Parent2</span> <a href=""></a>
<ul>
<li>
<span><i class="icon-leaf"></i> Child</span> <a href=""></a>
</li>
</ul>
</li>
</ul>
</div>
有遇到过这种Bootstrap树视图树结构的有经验的同事,如果树非常大,如何最好地组织搜索,这样在使用搜索时,正好打开所需的分支和元素。
<div class="tree well">
<ul>
<li>
<span><i class="icon-folder-open"></i> Theme</span> <a href="">ссылки место</a>
<ul>
<li>
<span><i class="icon-minus-sign"></i> Standard</span> <a href=""></a>
<ul>
<li>
<span><i class="icon-leaf"></i> Grand Child</span> <a href="">ссылки место</a>
</li>
</ul>
</li>
<li>
<span><i class="icon-minus-sign"></i> Child</span> <a href=""></a>
<ul>
<li>
<span><i class="icon-leaf"></i> Grand Child</span> <a href=""></a>
</li>
<li>
<span><i class="icon-minus-sign"></i> Grand Child</span> <a href="">ссылки место</a>
<ul>
<li>
<span><i class="icon-minus-sign"></i> Great Grand Child</span> <a href=""></a>
<ul>
<li>
<span><i class="icon-leaf"></i> Great great Grand Child</span> <a href=""></a>
</li>
<li>
<span><i class="icon-leaf"></i> Great great Grand Child</span> <a href=""></a>
</li>
</ul>
</li>
<li>
<span><i class="icon-leaf"></i> Great Grand Child</span> <a href=""></a>
</li>
<li>
<span><i class="icon-leaf"></i> Great Grand Child</span> <a href=""></a>
</li>
</ul>
</li>
<li>
<span><i class="icon-leaf"></i> Grand Child</span> <a href=""></a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<span><i class="icon-folder-open"></i> Parent2</span> <a href=""></a>
<ul>
<li>
<span><i class="icon-leaf"></i> Child</span> <a href=""></a>
</li>
</ul>
</li>
</ul>
</div>
.tree {
min-height:20px;
padding:19px;
margin-bottom:20px;
background-color:#fbfbfb;
border:1px solid #999;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px;
-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05)
}
.tree li {
list-style-type:none;
margin:0;
padding:10px 5px 0 5px;
position:relative
}
.tree li::before, .tree li::after {
content:'';
left:-20px;
position:absolute;
right:auto
}
.tree li::before {
border-left:1px solid #999;
bottom:50px;
height:100%;
top:0;
width:1px
}
.tree li::after {
border-top:1px solid #999;
height:20px;
top:25px;
width:25px
}
.tree li span {
-moz-border-radius:5px;
-webkit-border-radius:5px;
border:1px solid #999;
border-radius:5px;
display:inline-block;
padding:3px 8px;
text-decoration:none
}
.tree li.parent_li>span {
cursor:pointer
}
.tree>ul>li::before, .tree>ul>li::after {
border:0
}
.tree li:last-child::before {
height:30px
}
.tree li.parent_li>span:hover, .tree li.parent_li>span:hover+ul li span {
background:#eee;
border:1px solid #94a0b4;
color:#000
}
$(function () {
$('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch');
$('.tree li.parent_li > span').on('click', function (e) {
var children = $(this).parent('li.parent_li').find(' > ul > li');
if (children.is(":visible")) {
children.hide('fast');
$(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
} else {
children.show('fast');
$(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
}
e.stopPropagation();
});
});
告诉我,我向 AD 发出请求并通过控制台看到所有数据,但是如果我尝试将其添加到选择中,则会出现错误,我在哪里弄乱了代码?也许有更简单更好的代码。请不要严格判断,我只是学习,提前谢谢。
List<string> adlist = new List<string>();
using (var context = new PrincipalContext(ContextType.Domain, "domain.ru"))
{
using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
{
foreach (var result in searcher.FindAll())
{
DirectoryEntry de = result.GetUnderlyingObject() as DirectoryEntry;
var lastname = (de.Properties["sn"].Value != null) ? de.Properties["sn"].Value.ToString() : "";
var display = (de.Properties["displayName"].Value != null) ? de.Properties["displayName"].Value.ToString() : "";
if (lastname != "")
{
adlist.Add(display);
adlist.Distinct().ToArray();
}
}
ADUserList.DataSource = adlist;
ADUserList.DataBind();
}
}
<asp:DropDownList CssClass="form-control selectpicker" ID="ADUserList" runat="server"></asp:DropDownList>
[DirectoryServicesCOMException (0x80072020):发生操作错误。] System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +563130 System.DirectoryServices.DirectoryEntry.Bind() +45 System.DirectoryServices.DirectoryEntry.get_AdsObject() +40 System.DirectoryServices.PropertyValueCollection.PopulateList() +27
System.DirectoryServices .PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +119
System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +162
System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() +1400 System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() +47 System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +123 System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +40 System.DirectoryServices.AccountManagement.PrincipalSearcher.SetDefaultPageSizeForContext() +31 OrgChart.VisualWebPart1.VisualWebPart1UserControl.GetActiveDirectory() +245 OrgChart.VisualWebPart1.VisualWebPart1UserControl.Page_Load(Object sender, EventArgs e) +4108 System.Web.UI.Control。 OnLoad(EventArgs e) +106 System.Web.UI.Control.LoadRecursive() +68
System.Web.UI.Control.AddedControl(Control control, Int32 index) +11898100 OrgChart.VisualWebPart1.VisualWebPart1.CreateChildControls() +152
System.Web.UI.Control.EnsureChildControls( ) +106
System.Web.UI.Control. PreRenderRecursiveInternal() +66
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI. Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+6875
a href在 VS 项目中,出于某种原因,我试图通过“ Fill ”将从 C# 获得的值传递给 JS 函数,而不是值 value=" 1 "。新手不要严格判断:)谢谢大家。
C#
System.Web.UI.WebControls.TableCell tc = new System.Web.UI.WebControls.TableCell();
tc.Text = "<a title='Заполнить данные на " + arr.fio + "'class='btn btn-success btn-xs' onclick='_test(this);' value="1">Заполнить</a>";
tr.Cells.Add(tc);
JS
function _test(this_){
alert(this_.innerHTML);
}
我有以下日期,例如 2018 年 12 月 26 日和 2019 年 1 月 10 日。如何列出或添加从 2018 年 12 月 26 日到 2019 年 1 月 10 日范围内的所有日期?让它看起来像这样:
var date = ["26.12.2018","27.12.2018"..."10.01.2019"];
有一个json数组,如何编写代码在页面上显示时间段(开始和结束)相交的元素?
var periods = [
{
title: 'Иванов Иван',
category: 'Категория 1',
start : new Date('8/11/2018'),
end : new Date('8/14/2018')
}, {
title: 'Петров Петр',
category: 'Категория 1',
start : new Date('8/12/2018'),
end : new Date('8/16/2018')
}, {
title: 'Макаров Дмитрий',
category: 'Категория 1',
start : new Date('8/20/2018'),
end : new Date('8/25/2018')
}, {
title: 'Мочалов Роман',
category: 'Категория 2',
start : new Date('9/1/2018'),
end : new Date('9/10/2018')
}, {
title: 'Панкратов Сергей',
category: 'Категория 2',
start : new Date('10/1/2018'),
end : new Date('10/10/2018')
}, {
title: 'Глухов Константин',
category: 'Категория 2',
start : new Date('10/2/2018'),
end : new Date('10/5/2018')
}
];
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
我有一个列表,我正在获取值,但是我只需要从每个类别中获取第一个值,我如何在jQuery中编写一个条件以便控制台输出值:Title1 == Split,Title4 = = 已批准,Title7 == 无?
var data = [{
"Title": "Title1",
"Category": "Split"
}, {
"Title": "Title2",
"Category": "Split"
}, {
"Title": "Title3",
"Category": "Split"
}, {
"Title": "Title4",
"Category": "Aproved"
}, {
"Title": "Title5",
"Category": "Aproved"
}, {
"Title": "Title6",
"Category": "Aproved"
}, {
"Title": "Title7",
"Category": "None"
}, {
"Title": "Title8",
"Category": "None"
}, {
"Title": "Title9",
"Category": "None"
}, {
"Title": "Title10",
"Category": "None"
}];
我需要在代码中创建一个动态 JSON 数组,但在我的示例中出现错误,我错过了什么?我从头写代码,没看例子,我在学习:
无法获取值未定义或 NULL 的引用的属性“调用”
var json = [];
var start = ['8/12/2018','8/14/2018'];
var end = ['8/16/2018','8/20/2018'];
function createJson() {
$.each(function(start,end){
json.push({
start: start,
end: end
})
});
return console.log(json);
}
createJson();
因此,我需要以下结果:
json = [{
"start": "8/12/2018",
"end": "8/16/2018"
}, {
"start": "8/14/2018",
"end": "8/20/2018"
}];
请告诉我如何var dummyContent使用JS或JQuery修改变量中的文本,以便可以通过复制\过去代码将其插入“多行文本”字段,同时正常添加文本,带标签并保存。不要严格判断,我经历了很多例子,没有什么合适的。编码:
function copy() {
var dummyContent = 'Hello world';
var dummy = $('<input>').val(dummyContent).appendTo('body').select()
document.execCommand('copy')
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="button" id="Copyitem" value="Копировать текст" onclick="copy();">
告诉我,我有 2 个相互匹配的数据数组(名称和地址):1.Title,2.URL。Title数组中有空值,我想删除它们,只留下“相关”,第二个数组中有一个URL,也有值,其中一些值对应于Title中为空的,我想收集值 \u200b\u200bin select by Title=text, Value=URL ,我这样写代码,文本(Title)是正常的,但是结果是值(URL)[对象,对象]:
//В массиве arr1 (Title), такие значения:
var arr1 = ['Name1','Name2','Name3','','','','','',''];
//В массиве arr2 (URL), такие значения:
var arr2 = ['URL1','URL2','URL3','URL4','URL5','URL6','URL7','URL8','URL9'];
//Результат [Object, object] в значении
$('#View').append($('<option>', {
value: arr2,
text : arr1
}));
//Результат в значении нормальный только Title
$('#View1').append($('<option>', {
value: arr1,
text : arr1
}));
//Результат в значении нормальный только URL
$('#View2').append($('<option>', {
value: arr2,
text : arr2
}));
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<select id="View"></select>
<select id="View1"></select>
<select id="View2"></select>
为什么 runCode() 函数只能通过按钮 onclick 运行?从这个链接尝试了不同的选项,结果仍然没有改变,我应该注意什么?
var viewCollection = null;
function runCode() {
var clientContext = new SP.ClientContext.get_current();
if (clientContext != undefined && clientContext != null) {
var web = clientContext.get_web();
var listCollection = web.get_lists();
var list = listCollection.getByTitle("Tasks");
this.viewCollection = list.get_views();
var viewInfo = new SP.ViewCreationInformation();
viewInfo.set_title('MyView');
this.viewCollection.add(viewInfo);
clientContext.load(this.viewCollection);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
}
function onQuerySucceeded() {
var viewInfo = 'Tasks list current views: \n\n';
var viewEnumerator = this.viewCollection.getEnumerator();
while (viewEnumerator.moveNext()) {
var view = viewEnumerator.get_current();
viewInfo += view.get_title() + '\n';
}
alert(viewInfo);
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
<input id="Button1" type="button" value="Run Code" onclick="runCode()" />
你能告诉我如何使用 JQuery 和(或)JavaScript 使用我的表中的代码创建一个 JSON 数组,并在删除表中的一行时删除数组中的一行吗?那些。将表中的所有信息写入一个数组,使其看起来像这样:
[
{
"id": "1",
"country": "India",
"date": "",
"comment": "Hello world1"
},
{
"id": "2",
"country": "Germany",
"date": "",
"comment": "Hello world2"
}
]
function addRow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
for(var i=0; i<colCount; i++) {
var newcell = row.insertCell(i);
newcell.innerHTML = table.rows[0].cells[i].innerHTML;
//alert(newcell.childNodes);
switch(newcell.childNodes[0].type) {
case "text":
newcell.childNodes[0].value = "";
break;
case "checkbox":
newcell.childNodes[0].checked = false;
break;
case "select-one":
newcell.childNodes[0].selectedIndex = 0;
break;
}
}
}
function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
if(rowCount <= 1) {
alert("Cannot delete all the rows.");
break;
}
table.deleteRow(i);
rowCount--;
i--;
}
}
}catch(e) {
alert(e);
}
}
<INPUT type="button" value="Add Row" onclick="addRow('dataTable')" />
<INPUT type="button" value="Delete Row" onclick="deleteRow('dataTable')" />
<TABLE id="dataTable" width="350px" border="1">
<TR>
<TD><INPUT type="checkbox" name="chk"/></TD>
<TD><INPUT type="text" name="txt"/></TD>
<TD>
<SELECT name="country">
<OPTION value="in">India</OPTION>
<OPTION value="de">Germany</OPTION>
<OPTION value="fr">France</OPTION>
<OPTION value="us">United States</OPTION>
<OPTION value="ch">Switzerland</OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
是不是JSON格式?
{
"stage": [
{
"id": "1",
"type": "net",
"author": "Bill Dewaine",
"created": "2017-04-17T10:00:00+03:00",
"tags": [
"simple",
"fool"
]
},
{
"id": "2",
"author": "Seal Milf",
"created": "2017-03-37T10:00:00+03:00",
"tags": [
"simple",
"fool"
]
}
]
}
无法为数组添加值,我做错了什么?
var sd = $('#SD').val();
var fi = $('#FI').val();
var copa = $('#COPA').val();
var mm = $('#MM').val();
var sm = $('#SM').val();
var cc = $('#CC').val();
var autoArray = [];
for (i = 0; i < autoArray; i++){
autoArray.push(sd,fi,copa,mm,sm,cc);
}
console.log (autoArray);
请告诉我,我在 Web 部分中有 10 个复选框和 5 个单选按钮,我需要编写 if / else 之类的角色,但我发布的代码量会非常不错,即 在每个复选框中,您需要为其他人描述条件,因为 它们是相互联系的,现在的问题是如何简化这种写作,或者,例如,使用其他方法或框架?请告诉我。
请告诉我如何在屏幕截图中突出显示 Bootstrap 中的字段,我只是不需要验证,我对突出显示图像、字段、添加复选标记感兴趣。例如:
<div class="col-md-4 selectContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" name="User" id="User" class="form-control">
</div>
</div>
告诉我如何使用链接中此代码中的按钮重置这两个值 -
http://jsfiddle.net/9o41oykp/34/
$(function () {
$('.button-checkbox').each(function () {
// Settings
var $widget = $(this),
$button = $widget.find('button'),
$checkbox = $widget.find('input:radio'),
color = $button.data('color'),
settings = {
on: {
icon: 'glyphicon glyphicon-check'
},
off: {
icon: 'glyphicon glyphicon-unchecked'
}
};
// Event Handlers
$button.on('click', function () {
$checkbox.prop('checked', !$checkbox.is(':checked'));
$checkbox.triggerHandler('change');
updateDisplay();
});
// Actions
function updateDisplay() {
$('.button-checkbox').each(function () {
var isChecked = $(this).find('input:radio').is(':checked');
// Set the button's state
$(this).find('button').data('state', (isChecked) ? "on" : "off");
// Set the button's icon
$(this).find('button').find('.state-icon')
.removeClass()
.addClass('state-icon ' + settings[$(this).find('button').data('state')].icon);
// Update the button's color
if (isChecked) {
$(this).find('button')
.removeClass('btn-default')
.addClass('btn-' + color + ' active');
} else {
$(this).find('button')
.removeClass('btn-' + color + ' active')
.addClass('btn-default');
}
})
}
// Initialization
function init() {
updateDisplay();
// Inject the icon if applicable
if ($button.find('.state-icon').length == 0) {
$button.prepend('<i class="state-icon ' + settings[$button.data('state')].icon + '"></i> ');
}
}
init();
});
});
$('#reset').click(function() {
$('.button-checkbox').find('.glyphicon').toggleClass('glyphicon-check glyphicon-unchecked');
});
<span class="button-checkbox">
<button type="button" class="btn btn-lg" data-color="primary">Option 1</button>
<input type="radio" class="xhidden" name="group1" id="op1" checked />
</span>
<span class="button-checkbox">
<button type="button" class="btn btn-lg" data-color="primary">Option 2</button>
<input type="radio" class="xhidden" name="group1" id="op2" />
</span>
<br><br><button type="button" class="btn btn-info" id="reset">Reset<span class="glyphicon glyphicon-send"></span></button>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
我使用 JQuery、Bootstrap 制作了一个简单的表单,但我不明白为什么如果将光标放在该字段中,浏览器会简单地关闭页面((所有表单字段都是废话。
我创建了一个 Web 部件,其中该部件与 bootstrap 一起工作,并且我从 jquery 中为组合框创建了逻辑,一切正常,但是下拉列表被 bootstrap 字段隐藏了:

告诉我问题出在哪里以及在哪里挖掘,combobox jquery 的代码添加了:
$.widget("ui.combobox", {
_create: function() {
var self = this,
select = this.element.hide(),
selected = select.children(":selected"),
value = selected.val() ? selected.text() : "";
var input = this.input = $("<input>").insertAfter(select).val(value).autocomplete({
delay: 0,
minLength: 0,
source: function(request, response) {
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
response(select.children("option").map(function() {
var text = $(this).text();
if (this.value && (!request.term || matcher.test(text))) return {
label: text.replace(
new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(request.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"),
value: text,
option: this
};
}));
},
select: function(event, ui) {
ui.item.option.selected = true;
self._trigger("selected", event, {
item: ui.item.option
});
},
change: function(event, ui) {
if (!ui.item) {
var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
valid = false;
select.children("option").each(function() {
if ($(this).text().match(matcher)) {
this.selected = valid = true;
return false;
}
});
if (!valid) {
// remove invalid value, as it didn't match anything
$(this).val("");
select.val("");
input.data("autocomplete").term = "";
return false;
}
}
}
}).addClass("ui-widget ui-widget-content ui-corner-left");
input.data("autocomplete")._renderItem = function(ul, item) {
return $("<li></li>").data("item.autocomplete", item).append("<a>" + item.label + "</a>").appendTo(ul);
};
this.button = $("<button type='button'> </button>").attr("tabIndex", -1).attr("title", "Show All Items").insertAfter(input).button({
icons: {
primary: "ui-icon-triangle-1-s"
},
text: false
}).removeClass("ui-corner-all").addClass("ui-corner-right ui-button-icon").click(function() {
// close if already visible
if (input.autocomplete("widget").is(":visible")) {
input.autocomplete("close");
return;
}
// work around a bug (likely same cause as #5265)
$(this).blur();
// pass empty string as value to search for, displaying all results
input.autocomplete("search", "");
input.focus();
});
},
destroy: function() {
this.input.remove();
this.button.remove();
this.element.show();
$.Widget.prototype.destroy.call(this);
}
});
$('combo').combobox();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>


