jQuery选择器

ton*_*nyf 5 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"  />
Run Code Online (Sandbox Code Playgroud)

进入jQuery选择器格式

var $templateButtons = $('img[src^="wwv_flow_file_mgr"]').parent('a');
Run Code Online (Sandbox Code Playgroud)

但这似乎不正确.

有关如何将上述视图源代码转换为jQuery的任何想法?

谢谢,托尼.

Joh*_*sch 10

问题出在属性选择器上: $('img[src^="wwv_flow_file_mgr"]')

你在jQuery v1.3.2中遇到一个已知的错误 - jQuery正在尝试使用其绝对URL来解释图像路径,这意味着它所比较的​​URL实际上以" http://..." 开头

您可以暂时使用它*=(它查找包含文本"wwv_flow_file_mgr"的属性值而不是从它开始):

var $templateButtons = $('img[src*="wwv_flow_file_mgr"]').parent('a');
Run Code Online (Sandbox Code Playgroud)