사용자 입력을 요구하는 양식을 생성하고 새로 고치지 않고 php 파일로 보내려면 버튼을 사용하고 싶습니다. 그러나 양식을 html 파일에 첨부하고 제출하려고하면 java 기능이 작동하지 않습니다. 운영.jQuery로 양식 추가하기
제가 형태 추가하는 데 사용되는 함수 :
function reporterror(){
if (document.getElementById("report")){
console.log("Still have report");
}else{
$("<form id='report' action='report.php' method='post'><div ><h2 style='text-align:center;'>Report Error</h2><h3>Description:</h3><textarea rows='10' cols='60' name='report' id='description' placeholder='No more than 500 words' style='border-radius:10px;border:1px solid #000;'></textarea><input type='submit' style='border-radius:5px;'></input><input type='button' onclick='reportclose()' value='Close' style='border-radius:5px;'></input></div></form>").appendTo("#content");
}
을}; 실행 didnt한다
당신은 onsubmit 이벤트를 위임 할 필요가 있습니다 : http://learn.jquery.com/events/event-delegation/ 그러나 어떻게'reporterror()'메서드를 호출합니까 ??? –