<button class="btn-edit">수정</button> <div class="form-edit"> <form action="./" method="post" onsubmit="return procFilter(this, insert_comment)"> <input type="hidden" name="mid" value="{$mid}" /> <input type="hidden" name="document_srl" value="{$comment->get('document_srl')}" /> <input type="hidden" name="comment_srl" value="{$comment->comment_srl}"> <input type="hidden" name="content" value="{htmlspecialchars($comment->get('content'))}" /> {$comment->getEditor()} <block cond="!$is_logged"> <label for="userName">{$lang->writer}</label> <input type="text" name="nick_name" id="userName" value="{htmlspecialchars($comment->get('nick_name'))}" /> <label for="userPw">{$lang->password}</label> <input type="password" name="password" id="userPw" /> <label for="homePage">{$lang->homepage}</label> <input type="text" name="homepage" id="homePage" value="{htmlspecialchars($comment->get('homepage'))}" /> </block> <input type="submit" value="{$lang->cmd_comment_registration}" /> </form> </div>
수정버튼을 클릭하면 아래 form이 나타나고, 수정하면 됩니다.
스크립트는 알아서 수정하시면 됩니다.
jQuery(function($) { const btn = $(".btn-edit"); btn.on('click', function () { console.log('수정버튼클릭'); $(".form-edit").css('display','none'); $(this).next(".form-edit").css('display', 'block'); }) });