Селекторы jQuery

Если вы в Rails: Hash.deep_dup

5
задан halfer 7 December 2019 в 09:26
поделиться

2 ответа

The problem is with the attribute selector: $('img[src^="wwv_flow_file_mgr"]')

You're experiencing a known bug in jQuery v1.3.2 - jQuery is trying to interpret the image path using its absolute URL, which means the URL it's comparing actually starts with "http://..."

You can temporarily get around this using *= (which looks for an attribute value that contains the text "wwv_flow_file_mgr" instead of starting with it):

var $templateButtons = $('img[src*="wwv_flow_file_mgr"]').parent('a');
10
ответ дан 13 December 2019 в 19:33
поделиться

Это очень странно, это не работает с вашим селектором, хотя, я думаю, должно.

Однако, хотя он и не очень чистый, он все же работает с использованием фильтра, как показано ниже.

var $templateButtons = $("img")
                       .filter(function(){
                             return $(this).attr('src')
                                    .indexOf('wwv_flow_file_mgr')==0;
                       }).parent('a');
1
ответ дан 13 December 2019 в 19:33
поделиться
Другие вопросы по тегам:

Похожие вопросы: