<bdo id='p1Xcb'></bdo><ul id='p1Xcb'></ul>
  1. <small id='p1Xcb'></small><noframes id='p1Xcb'>

  2. <legend id='p1Xcb'><style id='p1Xcb'><dir id='p1Xcb'><q id='p1Xcb'></q></dir></style></legend>

    <tfoot id='p1Xcb'></tfoot>
    <i id='p1Xcb'><tr id='p1Xcb'><dt id='p1Xcb'><q id='p1Xcb'><span id='p1Xcb'><b id='p1Xcb'><form id='p1Xcb'><ins id='p1Xcb'></ins><ul id='p1Xcb'></ul><sub id='p1Xcb'></sub></form><legend id='p1Xcb'></legend><bdo id='p1Xcb'><pre id='p1Xcb'><center id='p1Xcb'></center></pre></bdo></b><th id='p1Xcb'></th></span></q></dt></tr></i><div id='p1Xcb'><tfoot id='p1Xcb'></tfoot><dl id='p1Xcb'><fieldset id='p1Xcb'></fieldset></dl></div>

      jquery 属性选择器找不到属性

      时间:2023-09-08
      • <i id='Nf1dP'><tr id='Nf1dP'><dt id='Nf1dP'><q id='Nf1dP'><span id='Nf1dP'><b id='Nf1dP'><form id='Nf1dP'><ins id='Nf1dP'></ins><ul id='Nf1dP'></ul><sub id='Nf1dP'></sub></form><legend id='Nf1dP'></legend><bdo id='Nf1dP'><pre id='Nf1dP'><center id='Nf1dP'></center></pre></bdo></b><th id='Nf1dP'></th></span></q></dt></tr></i><div id='Nf1dP'><tfoot id='Nf1dP'></tfoot><dl id='Nf1dP'><fieldset id='Nf1dP'></fieldset></dl></div>
      • <small id='Nf1dP'></small><noframes id='Nf1dP'>

          <tbody id='Nf1dP'></tbody>
              <bdo id='Nf1dP'></bdo><ul id='Nf1dP'></ul>

                <legend id='Nf1dP'><style id='Nf1dP'><dir id='Nf1dP'><q id='Nf1dP'></q></dir></style></legend>

                <tfoot id='Nf1dP'></tfoot>

                本文介绍了jquery 属性选择器找不到属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我需要重新提出我的老问题,我可能不应该在凌晨 1 点问过它:P

                I need to reask my old question, I probably shouldnt have asked it at 1am :P

                使用 jquery 的属性选择器似乎找不到某些属性:

                It seems that some attributes are not being found using jquery's attribute selector:

                $("*[some=value]");
                

                到目前为止,我似乎无法使用表单的 action 属性和 img 的 src 属性.是否有某个属性列表不起作用,以便我可以为它们编写自定义选择器?

                So far it seems that i cant use form's action attribute, and img's src attribute. Is there a list somewhere of attributes that do not work so i can write custom selectors for them?

                再次感谢!

                似乎没有人相信某些选择器不能按预期工作.看这个例子:在 this site (上面有 jquery 1.3 for firebugging)有一个看起来像这个:

                No one seems to believe that some selectors do not work as expected. Look at this example: On this site (which has jquery 1.3 on it for firebugging) there is a form that looks like this:

                <form style="display: inline;" method="get" action="list">
                

                (它围绕搜索当前下载"下拉菜单).如果您打开 firebug 并尝试使用此选择器:

                (its around the 'search current downloads' dropdown). If you open firebug and try this selector:

                $("form[action=list]"); 
                

                您将无法选择表单.action 属性没有什么特别之处.该页面上徽标图像的 src 也是如此:

                you will NOT be able to select the form. There is nothing special about the action attribute. Same goes for the src of the logo image on that page:

                <img alt="Logo" src="/p/aost/logo?logo_id=1238551994"/>
                

                不起作用的选择器是:

                $("img[src=/p/aost/logo?logo_id=1238551994");
                

                当然,我可以进行通配符匹配,这不是我想要的.

                Sure, i can do wildcard matches, that is not what i am after.

                推荐答案

                没有不受支持的属性的列表",因为不应该有;这是 jQuery 中的一个错误.

                There is no "list" of unsupported attributes because there shouldn't be; this is a bug in jQuery.

                这里是公开的门票:

                • 无法使用action属性选择表单
                • attr "action" 的表单和 Selectors 的属性过滤器
                • 属性src"的选择器与 1.2.6 中的工作方式不同

                显然,这些错误之间的共同点是 jQuery 将您指定的选择器字符串与完整的 URL 进行比较,而不是 HTML 中定义的实际 action/src 属性.这解释了为什么 attributeEndsWith 或 attributeContains 选择器在这种情况下确实有效.

                Apparently the common denominator between the bugs is that jQuery is comparing the selector string you specify against the full URL as opposed to the actual action/src attribute as it is defined in the HTML. This explains why the attributeEndsWith or the attributeContains selectors do work in this case.

                我建议只为表单/图像提供一个类/ID 并完成它.

                I would recommend just giving the form/image a class/ID and getting it over with.

                这篇关于jquery 属性选择器找不到属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:JavaScript Element.value 与 Element.getAttribute("value 下一篇:alt 和 alt="" 一样吗?

                相关文章

                最新文章

                  <bdo id='lo3zD'></bdo><ul id='lo3zD'></ul>
              1. <i id='lo3zD'><tr id='lo3zD'><dt id='lo3zD'><q id='lo3zD'><span id='lo3zD'><b id='lo3zD'><form id='lo3zD'><ins id='lo3zD'></ins><ul id='lo3zD'></ul><sub id='lo3zD'></sub></form><legend id='lo3zD'></legend><bdo id='lo3zD'><pre id='lo3zD'><center id='lo3zD'></center></pre></bdo></b><th id='lo3zD'></th></span></q></dt></tr></i><div id='lo3zD'><tfoot id='lo3zD'></tfoot><dl id='lo3zD'><fieldset id='lo3zD'></fieldset></dl></div>
                1. <tfoot id='lo3zD'></tfoot><legend id='lo3zD'><style id='lo3zD'><dir id='lo3zD'><q id='lo3zD'></q></dir></style></legend>

                    <small id='lo3zD'></small><noframes id='lo3zD'>