I have the following code that checks for click events on links inside of the
element with id = menu:
$("#menu")
.on('click', 'a[href^="/City"]', function (event) {
event.preventDefault();
$('#editLink').attr("data-href", link);
});
The HTML that this code works on looks like this:
<ul id="menu">
<li><a href="/City/0101004H">1</a></li>
<li><a href="/City/0101004I">2</a></li>
<li><a href="/City/0101004J">3</a></li>
<li><a href="/City/0101004K">4</a></li>
</ul>
I have two links on another part of my screen as below:
<a id="prev" href="#">Prev</a>
<a id="next" href="#">Next</a>
How can I make it so that if a user clicks on the “2” link then these links are changed to:
<a id="prev" href="/City/0101004H" title="City 1">Prev</a>
<a id="next" href="/City/0101004J" title="City 3">Next</a>
You can use do like :
Fiddle
Update:
2nd Fiddle