네 쉽지
var text = $('textarea#mytextarea').val(); //gets the text from textarea user your own id
if (text.indexOf("keyword") >= 0)
alert('keyword');
편집의 : 당신이 제출 버튼에 의해 트리거 될이 코드를 삽입해야합니다. 이 양식
다음
<form id="target" action="destination.html">
<input type="text" value="Hello there" />
<input type="submit" value="Go" />
</form>
경우 당신은.이
$('#target').submit(function() {
var text = $('textarea#mytextarea').val(); //gets the text from textarea user your own id
if (text.indexOf("keyword") >= 0)
alert('keyword');
return false;
});
는 $ ('#의 your_form')를 추가 수행하여 트리거 ({() 함수}) 제출할 수 있습니다 arround를! – powtac
그리고'if' 문 다음에 세미콜론을 제거하십시오. –
@powtac은 실제로 그 일을했다 – JSantos