selector can get image contain the attribute onclick
within the onclick there is a JS code ( windows.open ….href start with (/dailyTickets/front/requesttype.form.php) )
i want some thing like this :
var attr = $('img').attr('onclick');
if(typeof attr !== 'undefined' && attr !== false)
{
$ImgIndex = $('img').attr('onclick').value().indexOf("var w = window.open('/dailyTickets/front/requesttype.form.php").index();
if ($('img').attr('onclick').value().indexOf("var w = window.open('/dailyTickets/front/requesttype.form.php") == 0)
{
$('img:eq('"+$ImgIndex +"').hide();
}
}
you can test it here : http://jsfiddle.net/zu44E/3/
here is the image :
<img
alt=""
title="Ajouter"
src="/dailyTickets/pics/add_dropdown.png"
style="cursor:pointer; margin-left:2px;"
onclick="var w = window.open('/dailyTickets/front/requesttype.form.php?popup=1&rand=1489777051', 'glpipopup', 'height=400, width=1000, top=100, left=100, scrollbars=yes' );w.focus();"
></img>
I think your method is slightly off. First of all. Here’s my update:
http://jsfiddle.net/zu44E/7/
Here are the major changes I made:
attryou don’t get the value of that attr by callingvalue()$ImgContainsvariable, had your method worked, would have been a true/false because you equate theindexOfto 0 (thus boolean, true or false)filter