Javascript/in Browser: Jump to anchor

function jump(hashString){ var url = location.href; //Save the URL without hash part. location.href = "#" + hashString; //Jump to target anchor (by id). history.replaceState(null,null,url); //If you don't like hashes restore url. }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.