외부 PHP 파일에서 텍스트 영역을 지우는 해결책을 찾기 위해 주변을 둘러 보았습니다.외부 PHP 파일에서 textarea 지우기가 작동하지 않습니다.
기본적으로이 내 양식입니다 :
<iframe name="post_target" style="display:none;"></iframe>
<form action="post_status.php" method="post" target="post_target">
<div class="status_update">
<div id="update_type"></div>
<?php load_picture($_SESSION['profile_picture']); ?>
<textarea class="scrollabletextbox" placeholder="Share your thoughts" onkeyup="textAreaAdjust(this)" name="status_update" id="status_update"></textarea>
</div>
<div id="update_options">
<button id="post" name="post" onclick="javascript:postUpdate()">Post</button>
</div>
</form>
그리고 구조의 post_status.php는 기본적으로 호출 다음
<?php
function post_status($conn, $status){
// function
}
$status = $_POST['status_update'];
post_status($conn, $status);
?>
<script type="text/javascript">
// clear textarea
document.getElementById('status_update').value = "";
alert("passed clear");
</script>
은 무엇 일어나는 것은 : PHP 함수가 제대로 실행하지만 JS 부분은 그렇지 않다. '.value = ""'를 생략하면 경고 메시지가 표시되지 않습니다.
누구든지이 문제와 관련하여 아이디어가 있습니까?
시도 :'document.getElementById ("status_update"). reset();' – devpro
결과는 같습니다. 알림은 제출하지 않고 – TanguyH
경고를 실행하지 않습니다. – devpro