我们正在使用msDropDown插件来控制页面中的主题下拉控件。该插件从www.marghoobsuleman.com下载
我们不必在document.ready或任何地方应用任何功能,只需在下面添加引用就可以了。
<script src="../Scripts/jquery.dd.js" type="text/javascript"></script>
但它也将样式应用于列表框。这是脚本源:
http://www.keendevelopers.in/jquery.dd.js
有没有办法避免它们应用于列表框?为了避免这种情况,我们试着给css class&#34; elelistbox&#34;到所有列表框。
<asp:ListBox ID="ListITProgramming" runat="server" CssClass="listViewStyle elelistbox"
SelectionMode="Multiple" OnDataBound="ListITProgramming_DataBound"></asp:ListBox>
有人可以帮忙吗?
答案 0 :(得分:0)
我已经尝试了您的要求,并且根据以下代码将有助于解决您的问题。
$(document).ready(function(){
setTimeout(function () {
$("select[class!='elelistbox']").each(function (i) {
//alert($(this).attr('class'));
// do your stuff
$(this).msDropDown();
})
}, 500);
});
答案 1 :(得分:0)
我修好了。我添加了一个条件来检查jquery.dd.js文件中的“elelistbox”类。
$.fn.extend({
msDropDown: function(settings)
{
return this.each(function()
{
if (!$(this).hasClass('elelistbox')){
if (!$(this).data('dd')){
var mydropdown = new dd(this, settings);
$(this).data('dd', mydropdown);
};
};
});
}
});