Thank you that worked. I made some changes since my table row contains
more than one cell.

var mySearch = '63';
var a = $('table tbody tr td a:contains("' + mySearch + '")').filter
(function(){
                        //alert($.trim($(this).text()));
                        if($.trim($(this).text()) == mySearch)
                            return true;
                        else
                            return false;
                    });
var tr = $(a).parents('tr:eq(0)');

Thanks,
sridhar.

On Nov 25, 11:05 am, "Pierre Bellan" <[EMAIL PROTECTED]> wrote:
> Hi,
> I think you must use the filter function.
> I made this little test :
>
> var mySearch = '63';
> $('table tr:contains("'+mySearch+'")').filter(function(){
>     if ($.trim($(this).text()) == mySearch ) {
>         return true;
>     }
>     else{
>         return false;
>     }
>
> });
>
> The text() method removes all html tags, very useful here. The trim()
> function was a jquery addon, very useful too
>
> Pierre
>
> Samuel Goldwyn  - "I'm willing to admit that I may not always be right, but
> I am never wrong."
>
> 2008/11/25 Sridhar <[EMAIL PROTECTED]>
>
>
>
> > Hi,
>
> >   I am trying to get a reference to a table row that contains an
> > exact match of a text. But I am getting more than one row. can you
> > please help me? Following is the html table structure and the jquery
> > script.
> > -- html
> > <table>
> >   <tr>
> >       <td><a>063</a></td>
> >   </tr>
> >   <tr>
> >       <td><a>63</a></td>
> >   </tr>
> > </table>
>
> > -- script
> > var rows = $('table tr:contains(' + "'" + '63' + "'" + ')');
>
> > as you can see, both the rows contain text 63. But I want to get the
> > reference to second row since that contains the exact match. How would
> > I do that?
>
> > Thanks,
> > sridhar.

Reply via email to