Clicky

<a href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$gv1','Edit$18')">Edit</a>


I want to get all of these anchor tags with "Edit" in the middle  (between the <a> and </a>

S('a')

but then I am not sure what.  Is it val(  )  html(  )  or   text(  )?

asked 11/02/2011 07:22

knowlton's gravatar image

knowlton ♦♦


4 Answers:
This seemed to work:


 $('a').each(function ()
        {
            var atxt = $(this).text();

            if (atxt == "Delete")
            {
                $(this).css("float", "right");
            }
        });


For points...how could I optimize this?
link

answered

knowlton's gravatar image

knowlton

your script look fine : http://jsfiddle.net/dyKeM/

another one : http://jsfiddle.net/dyKeM/2/
be careful, work for Deletexyz
1:
$('a:contains("Delete")').css("float", "right");
1:
$('a').filter(function() { return $(this).text() == "Delete" }).css("float", "right");



link

answered 2011-11-02 at 16:32:52

leakim971's gravatar image

leakim971

Thank you.
link

answered 2011-11-02 at 16:57:05

knowlton's gravatar image

knowlton

NOTE:

What I wanted on the page was instead of

Edit  Delete
Edit  Delete
Edit  Delete

I wanted to create more space between them.  Some users with butter fingers end up deleting when they meant to edit:

Edit                   Delete
Edit                   Delete
Edit                   Delete

The above code does this (thx again)
link

answered 2011-11-03 at 06:44:13

knowlton's gravatar image

knowlton

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 11/02/2011 07:22

Seen: 407 times

Last updated: 11/03/2011 02:44

Categories