I use a script to detect url in text when someone paste a text with URL.
So I use this script:
$("#post").bind('paste', function(){
var $ptext = $('textarea#post').val();
var regexText = /^http:\/\/www$/;
if(regexText.test($ptext))
{
alert('URL DETECTED');
}
});
But when I reload the page and I paste the text for the first time the script does nothing and I'm forced to repaste the text again, and then the script works.
How do I solve this problem?