'Issue with getting my button codes to redirect users to another page?

I am having trouble with my code. I am using SharePoint 2013 and am trying to implement codes to get my buttons to redirect a user to another page. However, the buttons do not seem to function. Can anyone point out what I am doing wrong? Is it the code?

Example of the button codes:

<input id="btnSearch" onclick="return RedirectUrl();" type="button" value="Carian"/>  
 <input id="btnHome" onclick="return RedirectUrl(/itasset/_layouts/15/start.aspx#/Lists/it_list/AllItems.aspx);" type="button" value="home"/>  

Example of the page: enter image description here



Solution 1:[1]

Apparently you have a javascript function that redirects you to the new page. That function expects a variable as a string, so put the url between single quotes.

Try this:

RedirectUrl('/itasset/_layouts/15/start.aspx#/Lists/it_list/AllItems.aspx')

And ofcourse RedirectUrl() has no variable so it won't work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hellyeahniels