开发者

How do you write a custom jquery selector for all not shown fields excluding hidden fields

I want to write a custom selector to select all fields that are returned by the :hidden selector except for the fields tha开发者_开发知识库t are of type hidden.

Here's what I have. It's breaking the page with no console error.

$.extend($.expr[':'], {
notShown: $(':hidden').not("hidden")
});


$(':hidden:not([type="hidden"])')
  • hidden-selector[docs]
  • not-selector[docs]
  • attribute-equals-selector[docs]

If you're only interested in form elements, add the input-selector[docs] to the beginning of the selector.

$(':input:hidden:not([type="hidden"])')


Every example of making a custom selector they do something like this:

$.expr[':'].notShown = function(obj) { return $(obj).not('input:hidden').is(':hidden'); }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜