3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【HTML】戻るボタンの実装方法

Posted at

#はじめに
戻るボタンを実装する機会はかなり多いと思うのですが、そのときのための備忘録として残しておきます。

#戻るボタンの実装

##aタグでの実装

HTML
<a href="javascript:history.back();">戻る</a>

##buttonタグでの実装

HTML
<button type="button" onclick="history.back()">戻る</button>

type="button"をちゃんと記述しないと、デフォルトでtype=submitとなってしまうので要注意!!

##formタグでの実装

HTML
<form>
    <input type="button" onclick="history.back()" value="戻る">
</form>

#おわりに
すべてHTML内の実装したい箇所に記述すれば良いので簡単ですね。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?