[Solved] How to replace the first column('td') text or value of a table? or How to replace the text of a particular cell and make it hyperlink in a table.

I have the following table and I was trying to replace the string text of each 1st col with a link. So, the text “a1” and “a2” contents would be replaced with an according-to-link “google.com/a1” and “google.com/a2” etc…(whatever) .html contents.

Solution:

We can easily achieve this by using Jquery .each() function, When called it iterates over the DOM elements that are part of the jQuery object. Each time the callback runs, it is passed the current loop iteration, beginning from 0.

Concluson:

As we discussed in the solution Section, the .each() method is designed to make DOM looping constructs concise and less error-prone. When called it iterates over the DOM elements that are part of the jQuery object. Each time the callback runs, it is passed the current loop iteration, beginning from 0. More importantly, the callback is fired in the context of the current DOM element, so the keyword this refers to the element. We hope you find them helpful.

Shivaraju M

Over 3+ years experience in IT industry, good knowledge in . Net-based Web applications, windows applications, web services, and SPAs. I have played multiple roles related to technical delivery in multiple domains while working on over 10+ technologies. I am currently focused on continuous improvement and agile project management.

Post a Comment

Previous Post Next Post