jquery ui_更新jQuery UI窗口小部件选项

jquery ui

We're all used to passing options when instantiating an object, whether it be JavaScript or any other language.  Whether or not you can update those options later is usually up to the framework, and somehow many wont let you update them once they've been passed in.  Depending on how the initialization of the object is done, sometimes that makes sense, but in most cases you should be able to update an option at any given time.

实例化对象时,无论是JavaScript还是其他任何语言,我们都习惯于传递选项。 以后是否可以更新这些选项通常取决于框架,并且某种程度上,一旦传递了它们,您将不让您对其进行更新。这取决于对象的初始化方式,有时候这很有意义,但是大多数情况下,您应该可以在任何给定时间更新选项。

I recently needed to update a jQuery UI widget option and here's how you update any given option:

我最近需要更新jQuery UI窗口小部件选项,以下是更新任何给定选项的方法:

this.$editor.inlineEditor('option', 'forceOpen', true);

jQuery UI is mostly a legacy technology these days so I'm mostly passing this tip on for those having to maintain old code.  This does teach a good lesson:  always provide a method for modifying initial options, even if you don't foresee a reason to do so!

如今,jQuery UI主要是一种遗留技术,因此我主要将这些技巧传递给那些必须维护旧代码的人。 这确实教了一个很好的教训:即使您没有预料到这样做的理由,也要始终提供一种修改初始选项的方法!

翻译自: https://davidwalsh.name/update-jquery-ui-options

jquery ui

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值