I have tried the following code to add href to the a tag inside a td. it is working fine while i do in console. But when I try the same in my code it is not working. Can anyone
Use document.Ready()
$(document).ready(function() { $("table tbody tr td a").attr('href','http://www.google.com'); });
You need to ensure that the document is already loaded before you try to manipulate the DOM.
More info: http://api.jquery.com/ready/