how to refresh captcha text with JS or render?
I am using simpleCaptcha library to display captcha using servlet. requirement is to refresh the captcha if refresh button is pressed.
I have tried with render facility as well as using javascript but nothing is working on my end. following is my code for refresh button, captcha display and javascript function.
<h:graphicImage value="/img/refresh-s.png" onclick="changeCaptcha()" />
<f:verbatim>
<img id="myCaptcha" src="/RoyalCourtPortal-portlet/simpleImg" width="120" height="30" />
</f:verbatim>
function changeCaptcha(){
$('myCaptcha').attr('src', '/RoyalCourtPortal-portlet/simpleImg' );
}
/////////////////////////////////////////////////////////////////////////////////////////
Please while answering provide code example as I am very new with javascirpt.
Thanks in advance
regards