i redirect current "url" + "text" returned function1 when button clicked, in javascript:
function function1() { return window.location.href + "/search"; } <button id="mybutton" onclick=function1()> </button>
what solution achieve this?
my attempt doesn't work. in advance.
try out. need replace/change current href
function function1() { window.location.href = window.location.href + "/search"; }
<button id="mybutton" onclick=function1()> </button>
as added note can use window.location.replace(window.location.href + "/search");
replace current page , not keep in history. i.e. user cannot go previous page redirected page.
Comments
Post a Comment