how to extract value of captcha image and check that value

Posted by Klbaiju under jQuery on 2/12/2015 | Points: 10 | Views : 613 | Status : [Member] | Replies : 1
Hi,
in my application , iam using captcha for security.
in my login example i want to check the captcha value.

here is my jquery code
$('#btnsave').click(function (e) {
e.preventDefault();
var txtval=$('#txtcapcha').val();
var captcha = $('#imgCaptcha').val();
if(txtval==captcha)
{
//go to another page

}

});

when i tried to display captcha value in alert box it is showing empty.
how to solve it.


Regards
Baiju




Responses

Posted by: Jitendrasoft09 on: 2/13/2015 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi,

It seems to look image tries to take values same as text. But if you need to take value of image such as source path or any other attribute what actually you need to take from image, below is the code which takes the source of the image. try with below approach and try to go ahead to meet your requirement.

var captcha = $("#imgCaptcha").attr('src');

alert(captcha);


Jitendra Kumar
If my post helps you, plz mark as an answer.

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response