MSDropDown: applying the style on both Drop down and ListBoxes as well

2k views Asked by At

We are using msDropDown plugin to theme drop down control in the page. The plugin was downloaded from www.marghoobsuleman.com

We don't have to apply any function in document.ready or anywhere just adding below reference does it's job.

<script src="../Scripts/jquery.dd.js" type="text/javascript"></script>

But it it applying the style to list boxes as well. here is the script source:

http://www.keendevelopers.in/jquery.dd.js

Is there any way to avoid them applying on List boxes? To avoid this we tried giving css class "elelistbox" to all Listboxes.

 <asp:ListBox ID="ListITProgramming" runat="server" CssClass="listViewStyle elelistbox"
                                                        SelectionMode="Multiple" OnDataBound="ListITProgramming_DataBound"></asp:ListBox>

Can anyone help?

2

There are 2 answers

0
Dhaval Panchal On BEST ANSWER

I fixed it. I have added one condition to check the "elelistbox" class in jquery.dd.js file.

$.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);
                    };
                };
            });
        }
});
0
Bhavesh Kachhadiya On

I have tried your requirement and as per that following code will help to solve your issue.

$(document).ready(function(){

           setTimeout(function () {
               $("select[class!='elelistbox']").each(function (i) {
                    //alert($(this).attr('class'));
                    // do your stuff
                    $(this).msDropDown();
               })
           }, 500);

       });