0

我有一个定义的命名空间: Cookies在它下面ShowLabelsShowOptions

我希望能够使用 jquery val 调用页面上的命名空间,假设它将返回ShowLabelsShowOptionsIE:

Cookies.$.trim($(this).val())

我怎样才能做到这一点?

4

1 回答 1

3

使用方括号通过字符串名称访问属性:

Cookies[$.trim($(this).val())]
于 2013-08-15T16:17:00.587 回答