function fwrite_submit(f) 에서 content 앞뒤로 문자열추가 채택완료
안녕하세요.
질문그대로 글쓰기시 자동으로 입력된 내용 앞뒤로 문자열을 추가해서 submit 하고자 합니다.
에를들어 본문 내용이 '안녕하세요.' 이면 자동으로
여러분 안녕하세요. 반갑습니다.
와 같이 여러분 과 반갑습니다. 를 붙여서 submit 하는겁니다.
function fwrite_submit(f) 에서 아래의 코드 부분에 해당내용을 추가하면 될거같은데
문법이 약해서 계속 에러만 떨어지네요.;;;
조언부탁드립니다. 감사합니다.
</strong></p>
<p>function fwrite_submit(f) {
<?php echo $editor_js; ?> // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함</p>
<p> var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
type: "POST",
data: {
"subject": f.wr_subject.value,
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});</p>
<p> if (subject) {
Swal.fire({
title: "알림!",
html: "제목에 금지단어 '<strong class='text-crimson'>"+subject+"</strong>' 단어가 포함되어있습니다.",
confirmButtonColor: "#e53935",
icon: "error",
confirmButtonText: "확인"
});
f.wr_subject.focus();
return false;
}</p>
<p> if (content) {
Swal.fire({
title: "알림!",
text: "내용에 금지단어 '<strong class='text-crimson'>"+content+"</strong>' 단어가 포함되어있습니다.",
confirmButtonColor: "#e53935",
icon: "error",
confirmButtonText: "확인"
});</p>
<p> </p>
<p> if (typeof(ed_wr_content) != "undefined")
ed_wr_content.returnFalse();
else
f.wr_content.focus();
return false;
}</p>
<p> if (document.getElementById("char_count")) {
if (char_min > 0 || char_max > 0) {
var cnt = parseInt(check_byte("wr_content", "char_count"));
if (char_min > 0 && char_min > cnt) {
Swal.fire({
title: "알림!",
html: "내용은 <strong class='text-crimson'>"+char_min+"</strong> 글자 이상 쓰셔야 합니다.",
confirmButtonColor: "#e53935",
icon: "error",
confirmButtonText: "확인"
});
return false;
}
else if (char_max > 0 && char_max < cnt) {
Swal.fire({
title: "알림!",
html: "내용은 <strong class='text-crimson'>"+char_max+"</strong> 글자 이하로 쓰셔야 합니다.",
confirmButtonColor: "#e53935",
icon: "error",
confirmButtonText: "확인"
});
return false;
}
}
}</p>
<p> <?php echo $captcha_js; ?> // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함</p>
<p> document.getElementById("btn_submit").disabled = "disabled";</p>
<p> return true;
}</p>
<p><strong>
답변 2개
f.wr_content.value 가 내용이라서요.
f.wr_content.value = "여러분 반갑습니다. "+f.wr_content.value;
이런식으로 마지막단에 넣으시면 됩니다.
</p>
<pre>
<code>function fwrite_submit(f) {</code></pre>
<p><code>f.wr_content.value = "</code>여러분 반갑습니다. <code>"+f.wr_content.value;</code></p>
<p><code>}</code></p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인