如何在启用和禁用onClick按钮之间切换选择框...
方案:
如果我点击#locked
div,则此div应与另一个类“icon-unclocked
”切换,并且应启用selectbox。如果我再次点击“#locked
”,则应停用选择框,并且必须删除“icon-unclocked
”。
第一部分(toggleClass)效果很好..但在启用/禁用选择框时遇到问题...
请检查以下代码......
HTML:
<div class="icon-locked" id="locked"> </div>
<select class="form-control" id="signontype" disabled>
<option>Option 01</option>
<option>Option 02</option>
</select>
jQuery的:
$(document).ready(function(){
$( "#locked" ).click(function() {
$( this ).toggleClass( "icon-unlocked" );
$('select#signontype').prop('disabled', false);
});
});
答案 0 :(得分:4)
试试这个:
using (SpreadsheetDocument myDoc = SpreadsheetDocument.
Create(Server.MapPath("/data.xls"), SpreadsheetDocumentType.Workbook))
{
WorkbookPart workbookpart = myDoc.AddWorkbookPart();
workbookpart.Workbook = new Workbook();
// Add a WorksheetPart to the WorkbookPart.
WorksheetPart worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
//add column names to the first row
Row header = new Row();
header.RowIndex = (UInt32)1;
SheetData sheetData = new SheetData();
Cell headerCell = createTextCell(1, 1, text);
header.AppendChild(headerCell);
sheetData.AppendChild(header);
// Add a WorkbookPart to the document.
worksheetPart.Worksheet = new Worksheet(sheetData);
//this is the part that was missing from your code
Sheets sheets = myDoc.WorkbookPart.Workbook.AppendChild(new Sheets());
sheets.AppendChild(new Sheet()
{
Id = myDoc.WorkbookPart.GetIdOfPart(myDoc.WorkbookPart.WorksheetParts.First()),
SheetId = 1,
Name = "Sheet1"
});
}
您可以查看$("#locked").click(function () {
$(this).toggleClass("pulse-icon-unlocked");
$('select#signontype').prop('disabled', !$(this).hasClass("pulse-icon-unlocked"));
});
是否有课程#locked
答案 1 :(得分:3)
答案 2 :(得分:1)
答案 3 :(得分:0)
$("YourElementID").selectbox('disable')
将停用selectpicker选择框。
注意:这适用于 selectbox版本0.2 。我不确定最新版本。