Jess McKenzie Jess McKenzie - 19 days ago 8
jQuery Question

Change a href url on page load

Is there a quick and easy way to change/overwrite a

href
url sturcture on page load?

The HTML structure is very basic:

Code:

<ul class="sub_menu" style="visibility: hidden;">
<li><a href="value">someLink</a></li>
</ul>

Answer

Try this it works

$(document).ready(function() {
 $('a[href*="value"]').attr('href' , 'your url');
});   

or

$(document).ready(function() {
 $('ul.sub_menu li a[href=value]').attr('href' , 'your url');
}); 
Comments