Need to know if a jQuery UI Widget has been applied to a DOM object

后端 未结 5 1897
我寻月下人不归
我寻月下人不归 2021-02-18 12:52

I\'m using jQuery and have some interactions with a jQuery UI where I need to get options. However there\'s a possibility that the jQuery UI function has not been applied yet t

5条回答
  •  一生所求
    2021-02-18 13:23

    You can access the progress bar object on the element by doing:

    $("#myid").data("progressbar")
    

    So to use this:

    var progressBar = $("#myid").data("progressbar");
    if ( progressBar == null ) {
        // handle case when no progressbar is setup for my selector
    } else {
        alert("The value is: " + progressBar.value());
    }
    

提交回复
热议问题