Tuesday, 10 September 2013

Jquery select previous element

Jquery select previous element

I am new to Jquery and I've had a look through the replies on here but I
can't find any specific answers to my question.
I have a (ASP) generated table a snippet of which is:
<a href="javascript:__doPostBack(&#39;gv2&#39;,&#39;Select$15&#39;)"
style="color:White;">S</a></td><td style="font-size:XX-Small;">1104</td>
<td style="font-size:XX-Small;">320.20.0116.090</td>
<td style="font-size:XX-Small;">*Not Found*</td>
What I'm trying to do is highlight the *Not Found text and then disable
the preceeding href so the link cannot be clicked.
I have developed the following selector:-
$('td').highlight('Not
Found').each(function(){$(this).prev("a").removeAttr("href")});
The highlight selector works but the removeattr doesn't. Syntax is
probably incorrect but any pointers would be very useful.

No comments:

Post a Comment