Use jquery ':contains' to find specific javascript within a span
Posted
by Rob
on Stack Overflow
See other posts from Stack Overflow
or by Rob
Published on 2010-04-28T15:52:41Z
Indexed on
2010/04/28
16:03 UTC
Read the original article
Hit count: 192
jQuery
This is my first time here, I hope that this is clear.
So i will have code similar to this this.
<span class="mediaSource ui-draggable" id="purchsePlay7915504">
<a href="" onclick="return popup_window(this, 'MediaView', 850, 680)" class="control" enter code hereid="GenericLink"></a>
<img id="Any_71" alt="Media Source" src="images/9672web.gif" class="mediaStationIcons mediaWin"/>
<img class="player" alt="Media Source" src="images/playmedia.gif" style="display: none;"/>
</span>
The href portion is generated on the backend, and I have no access to it.
I need to modify some existing jquery code to do something based on what the 'onclick' function is(there are different ones e.g. popup_window1,popup_window2 etc.) .
I tried something like this:
$('.segmentLeft span.mediaSource').click(function(){
if ($('span:contains("popup_window")').length > 0) {
do something
}
});
but it does not seem to work.
© Stack Overflow or respective owner