开发者_开发知识库Does anyone know how to check if the called ui (custom) has also options input or using the defaults?
For example:
$('#selector').myUI();//does not have options.
$('#selector').myUI({option:'foo',{op:'bar'}});//ui has options.
$('#selector').myUI('value');//ui has options.
So if I was on:
(function($) {
$.widget("ui.myUI", {
options = this.options;
//check if options have been entered or the default values have been used?
})
});
To check whether an option has been specified, you can write
if (options.hasOwnProperty('someProperty'))
My guess is the only way to find out is to compare them against the default values.
But I'm not that familiar with the inner workings of jQuery.
精彩评论