Wednesday, 2 October 2013

Confirm box in jquery

Confirm box in jquery

i new in jquery. basically what i want to do is, when user click #modquote
it will check the textarea whether it's empty or not. If not, it will
popup confirm box. if user click OK, it will proceed to the next step
(line 9 and below), if CANCEL nothing will happen. My problem is when
confirmation box appear, whether user click OK/CANCEL nothing happen. I
just wonder, whether I can use confirm box in jquery or not, or i miss
same code somewhere? Thanks you for helping..
$( '#modquote')
.click(function() {
var msgrep = $('textarea#modrepmsg').val();
if (msgrep != '')
{
confirm("test?");
return true;
}
var comment = $('#repmsg').val();
var regex = /<br\s*[\/]?>/gi;
var quote = '>' + comment.replace(regex, "\n>") + '\n';
//$("textarea#modrepmsg").html(comment.replace(regex, "\n "));
//var quote = ">" + comment + "\n";
//alert (quote);
//var count = comment.length;
$('textarea#modrepmsg').html(quote);
});

No comments:

Post a Comment