Add a text to the end

I'm working with an old code that uses Grid.MVC and I need to add a parameter to do something. I've tried C# code, and some other ways but still couldn't get what I wanted to work.

I want to try one last thing in jQuery before I break the news to my manager that this is old code and we should leave it as is.

I'll explain.

1. You see the screenshot below
2. When user clicks on a "page" button, I want to either  add another word to end of the "page" OR tag a word to the end of the page number End of the page number would be better.

 <a href="/?page=3">3</a>

3.  I used "rightDiv" element but I think "tableMain2" is better. I somehow need to drill down to get the "a" element

$('#tableMain2').click(function (e) {

			//find the ul named "pagination" 
                       //when user clicks on "a" , tag a text... for example "hello" to it

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Not 100% sure what you want to do.

Firstly, you don't want to do the binding on the click on the pagination inside the click on the table because each time you click the table you will bind another event handler instance.

To find the pagination link

$('table').on('click','.pagination a', function(e) {
   // might need to add e.preventDefault() here
   // To add to the <a> text
   $(this).html($(this).text() + ' Hello');

Open in new window

I would need more detail on what you are wanting to do though - the above will keep adding text on each click which I am pretty sure you don't want. I don't understand why you want to do this - so I can't give an absolute solution - if you could explain it a bit better I will try to give a more comprehensive answer.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CamilliaAuthor Commented:
Ok, I'll explain in detail soon.
CamilliaAuthor Commented:
Thanks, Julian. That should work but I decided to back out of the code and what I wanted to try to make work.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.