我有这个功能,我想让var
类别具有具有 id 的组合框的值#ticket_category_clone
我究竟做错了什么?
function check () {
var category="#ticket_category_clone";
if (category=="Hardware")
{
SPICEWORKS.utils.addStyle('#ticket_c_hardware_clone{display: none !important;}');
}
}
SPICEWORKS.app.helpdesk.ready(check);
编辑
如果我以这种方式编写代码,它只会发出警报:
function check () {
// var category = document.getElementById('#ticket_c_hardware_clone').value;
var category ="Hardware";
alert(category)
if (category=="Hardware")
{
SPICEWORKS.utils.addStyle('#ticket_c_hardware_clone{display: none !important;}');
}
alert(category)
}
SPICEWORKS.app.helpdesk.ready(check);
</p>
像这样?http://img12.imageshack.us/img12/8438/semttuloluu.png
和代码:
<select id="ticket_category_clone" name="ticket[category]" hdpp="ticket_category"><option value=""></option>