teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追記

2019/11/15 02:46

投稿

kyoya0819
kyoya0819

スコア10434

answer CHANGED
@@ -1,1 +1,24 @@
1
- パッと思いついたのはaタグにあらかじめモーダルを閉じるように設定してaの機能を無効化してクリックされた要素のhref属性を取得してJsでジャンプかな?
1
+ パッと思いついたのはaタグにあらかじめモーダルを閉じるように設定してaの機能を無効化してクリックされた要素のhref属性を取得してJsでジャンプかな?
2
+
3
+ ```HTML
4
+ <a href=https://google.co.jp id=a1>aiueo</a>
5
+ ```
6
+ ```CsS
7
+
8
+ a {
9
+ display: inline-block;
10
+ width: 100px;
11
+ height: 100px;
12
+ background: yellow
13
+ }
14
+
15
+ ```
16
+ ```JS
17
+
18
+ document.getElementById('a1').onclick = function(){
19
+ document.getElementById('a1').style.width = '300px';
20
+ window.open(document.getElementById('a1').getAttribute('href'));
21
+ return false;
22
+ }
23
+
24
+ ```