Skip to content
Advertisement

Change url onclick without javascript or jquery

How can I change url location in same window onlick without script for this button:

<button type="submit" name="select" value="true" onclick="window.open('/newurl')" class="btn btn-default2 btn-block"><i class="fa fa-car"></i>Search</button>

Now it goes back 1, but instead I want it to go to some url.

EDIT: how can I do it with javascript instead? HTML

Advertisement

Answer

  1. changing the script

    'onclick="location='somewhereelse.html'; return false ', 'cancel');

  2. using a link

    <a href="somewhereelse.html" class="styledlikeabutton">Cancel</a>

  3. Best solution if you need to submit the form: redirect from server using a redirect header

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement