jQuery - Selector for duplicate ID's

前端 未结 7 1197
名媛妹妹
名媛妹妹 2020-12-02 00:40

I have a page with duplicate ID\'s for a form element. The catch is I the elements show up separately based on a toggle. So both ID\'s never show up simultaneously.

7条回答
  •  醉梦人生
    2020-12-02 00:45

    try :hidden

       $("#my_element").find(":hidden").val();
    

    Elements can be considered hidden for several reasons:

    They have a CSS display value of none.
    They are form elements with type="hidden".
    Their width and height are explicitly set to 0.
    An ancestor element is hidden, so the element is not shown on the page.
    

    NOTE: Elements with visibility: hidden or opacity: 0 are considered to be visible,

提交回复
热议问题