'Jquery or Javascript if a textarea or input field contains a url - Honey Pot
I am getting a bunch of spam on a web form with URLs. There is no reason for a user to submit a url in this form.
I am trying to write a script to push a spam bot to a post url that doesnt exist.
Here is my code that I cannot get to work...
function testcheck() {
var submitURL = jQuery('#returnUrl')[0].value;
if( jQuery("textarea#question").contains("http")) {
$('.validate').attr('action', 'fakesubmission.php');
window.location.replace(submitURL);
return false;
}
}
What I am trying to do with this function is if http is inputted in the field. Then it will submit to fakesubmission.php. I just need help on the if statement.
Thank you in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
