NietzscheProgrammer NietzscheProgrammer - 1 year ago 79
Javascript Question

How to change specific href attribute with jQuery?

I have an element that I want to change in my page with jQuery:

<a class="table-cell" title="Affordable Loan Solution™ Mortgage" href="/en/articles/affordable-loan-solution-mortgage.html" name="affordableloansolutionmortgage_image_topicgrid">

<span class="linkwidth"> Affordable Loan Solution™ Mortgage </span>
<img alt="Affordable Loan Solution™ Mortgage" src="/res/img/topic/article.gif">


I want to change that href which is automatically generated and put this instead:

what can I do in this case?

Answer Source

Get element using name attribute with help of attribute equals selector and update href attribute using attr() method.

// or using class selector
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download