私はヘルプウィンドウを表示するフォームでdivを設定しました。そして、onclick関数を使ってトップの右隅に 'X'を設定したいと思います窓を閉めて。このdivはHTMLの一番下にあり、最後のbodyタグの直前に正しい位置がありますか? 私はディスプレイでこれをやりたいと思っています、注意してください:、なしのタグを(示していない)または非表示() HTMLonclick 'help window'を閉じる関数が機能しない
<div id="personalhelp"><p class="x"><a href="" onclick="close()">x</a></p>
<p class="help">Your personal information is needed to ensure we provide the most
relevant information and options for you. We will never sell your personal
information to third parties for any reason.</p>
<p class="help">Please fill in all required fields,
these are identified with an asterisk (*)</p>
</div>
機能(jQueryの)
function close() {
var getid = $(this).parent.attr('id');
console.log(getid);
$(getid).css("display", "none");
}
CSS
#personalhelp {
position: fixed;
right: 10%;
top: 10%;
max-width: 60%;
display: block;
background-color: #D3D3D3;
color: #000;
margin: 5px auto;
border: 2px solid #000;
display: block;
}
.x {
position: absolute;
right: 1%;
top:1%;
padding: 1px;
margin: 0 auto;
}
.help {
padding: 10px;
}
私は以下の私の答えで述べたように、変更のコールバック名close' 'から –