Here is what I am trying to accomplish.
When the modify button is clicked, I want the div with role 'ucomment' to transform into an input form with its original value pre-filled.
However, I am having trouble selecting the specific div.
I attempted to use the following code to target the desired element, but it did not work as expected.
$(this).closest("div[role='ucomment']")
How can I correctly select the div in this situation?
<ul id="comments" class="list-group">
<script id="commentTemplate" type="text/x-handlebars-template">
{{#each list}}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="row w-100">
<div class="col-2" name="uid">{{uid}}</div>
<div class="col-8" role="ucomment" name="ucomment">{{ucomment}}</div>
<div class="col-2" name="regdate">{{prettifyDate regdate}}</div>
</div>
<button type="button" class="btn" onclick="modifyComment()">Modify</button>
<button type="button" class="btn" onclick="deleteComment()">Delete</button>
<span class="badge badge-primary badge-pill">14</span>
</li>
{{/each }}
</script>
</ul>
<button id="sendForm" type="submit" class="btn btn-info" onclick="addComment()">Send</button>
<button id="cancel" type="button" class="btn btn-warning" data-toggle="collapse" data-target="#openNew">Cancel</button>
</div>