Here’s my sample code..
<script type="text/javascript">
$(function(){
$("a.change").click(function(){
$("a.change").hide();
$("div#change").append("<a href=''>Hello world!</a><a href=''>lounge</a>");
});
});
</script>
<div id="change">
<a href="javascript:;" class="change" name="change">Change Vote</a>
</div>
The code works great..but i read in various forums about using “href=javascript:;” as inconsistent and outdated! Is that true? If yes, then how do I overcome this obsoleteness?
Set the
hrefto a sensible server side fallback for middle-clickers and non-JS users.… and in this case, since “Change Vote” is not idempotent, you should also use a POST form instead of a link.