Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery选择器_Jquery_Css Selectors - Fatal编程技术网

jQuery选择器

jQuery选择器,jquery,css-selectors,Jquery,Css Selectors,我试图从视图源获取此信息,即: <a href="javascript:validateCB();"><img src="wwv_flow_file_mgr.get_file?p_security_group_id=1343380920146312332&p_flow_id=222&p_fname=submit_btn.gif" alt="Submit Details" border="0" /> 但这似乎并不正确 如何将上述视图源代码转换为jQue

我试图从视图源获取此信息,即:

<a  href="javascript:validateCB();"><img src="wwv_flow_file_mgr.get_file?p_security_group_id=1343380920146312332&p_flow_id=222&p_fname=submit_btn.gif" alt="Submit Details" border="0"  />
但这似乎并不正确


如何将上述视图源代码转换为jQuery?

这很奇怪,它与您的选择器不兼容,尽管我认为应该这样做

然而,虽然不是很干净,但它确实可以使用如下所示的过滤器工作

var $templateButtons = $("img")
                       .filter(function(){
                             return $(this).attr('src')
                                    .indexOf('wwv_flow_file_mgr')==0;
                       }).parent('a');

属性选择器存在问题:
$('img[src^=“wwv\u flow\u file\u mgr”])

您在jQuery v1.3.2中遇到了一个问题-jQuery试图使用其绝对URL解释图像路径,这意味着它正在比较的URL实际上以“
http://...

您可以使用
*=
(它会查找包含文本“wwv\u flow\u file\u mgr”的属性值,而不是从它开始)暂时绕过此问题:


感谢您提供有关此错误的详细信息。我不知道它存在。您好,尝试了这个,但我得到了以下错误,即“attr(…)”为null或不是对象。不确定是否来自此代码段:$templateButtons.attr('data-submitval',function(){return$(this.attr('onclick').toString().split('\n')[2];});任何帮助都将不胜感激。
var $templateButtons = $("img")
                       .filter(function(){
                             return $(this).attr('src')
                                    .indexOf('wwv_flow_file_mgr')==0;
                       }).parent('a');
var $templateButtons = $('img[src*="wwv_flow_file_mgr"]').parent('a');