gpt4 book ai didi

html - 我怎样才能得到我想回复的特定评论的 ID

转载 作者:行者123 更新时间:2023-11-28 01:18:31 26 4
gpt4 key购买 nike

下面是我写的代码,我想获得特定的 id 来回复评论,我如何用下面的代码做到这一点。请检查我下面的代码片段并建议我需要遵循的方式

.anc {
cursor: pointer;
}
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<a class="anc" data-toggle="modal" id="1" data-target="#add-reply">Reply 1</a>
<a class="anc" data-toggle="modal" id="2" data-target="#add-reply">Reply 2</a>
<a class="anc" data-toggle="modal" id="3" data-target="#add-reply">Reply 3</a>
<div class="modal fade modal-add-review" id="add-reply" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i></button>
<h4 class="modal-title">Reply</h4>
</div>
<div class="modal-body">

<form class="comment-form" method="post">
<p class="comment-notes">
<span id="email-notes">
Your email address will not be published.
</span> Required fields are marked
<span class="required">*</span>
</p>
<div class="row">
<div class="form-group comment-form-author col-sm-6">
<label for="author">Name<span class="required">*</span></label>
<input class="form-control" id="reply_author" name="reply_author" type="text" required value="" placeholder="Enter your name">
</div>
<div class="form-group comment-form-email col-sm-6">
<label for="email">Email<span class="required">*</span></label>
<input class="form-control" id="reply_email" name="reply_email" type="email" required value="" placeholder="Enter your email">
</div>
</div>
<div class="form-group comment-form-comment">
<label for="comment">Comment<span class="required">*</span></label>
<textarea class="form-control" id="reply_content" name="reply_content" required placeholder="Enter your message"></textarea>
</div>
<button class="btn btn-primary" name="create_reply" type="submit">
<i class="fa fa-check"></i>Submit
</button>
</form>

</div>
</div>
</div>
</div>

最佳答案

你可以这样使用:-

$('.commentBox').on('click', '.replyBtn', function(){
$(this).parents('.commentBox');
})
<div class="commentBox">
<div class="modal fade modal-add-review" id="add-reply" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i></button>
<h4 class="modal-title replyBtn">Reply</h4>
</div>
<div class="modal-body">

<-- MODAL REPLY FORM -->

</div>
</div>
</div>
</div>
</div>

关于html - 我怎样才能得到我想回复的特定评论的 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51669668/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com