• No replies
289 Posts

Pinned topic how to refresh captcha text with JS or render?

‏2012-11-05T17:56:04Z |
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()" />


function changeCaptcha(){
$('myCaptcha').attr('src', '/RoyalCourtPortal-portlet/simpleImg' );

Please while answering provide code example as I am very new with javascirpt.
Thanks in advance