+ 2

How to get form data from any form on any web page and how to know that the form is submitted? Plz help me out.

what I am trying to do is that I am making a chrome extension which gets all the form data and checks if the form was submitted or not. my try is something like this(using jquery): //for checking if the form was submitted or not $('form').submit(function(e){ e.preventDefault(); //some ajax stuff i will be doing for authentication console.log('submitted'); }); //this is for getting form data. let m=$('form'); let n=m.attr('type'); for(let i=0;i<m.length;i++){ if(n[i]=="password" || n[i]=="text" || n[i]=="email"){ console.log(m[i].value); } } ************************ my problem: when I'm running this its working fine on schoolofai.com, facebook.com, etc but it is not working on Twitter and Instagram login and many other logins as well. in twitter login, the submit detection is not working and in Instagram both the input detection and submit detection not working. is there any effective way of doing this for any kind of form on any webpage. if so then plz help me out .

6th Sep 2018, 9:40 AM
S O U ✌️ I K
S O U ✌️ I K - avatar
2 odpowiedzi
+ 14
Have you tried using the “this” keyword within the submit handler to identify the form? You would just need to replace this line: let m = $('form'); with this line: let m = $(this);
1st Jan 2019, 4:54 AM
Pao
Pao - avatar
+ 1
Pao yeah i tried that too but its still not working. I think twitter loads its components dinamically thats why maybe its not working
1st Jan 2019, 4:56 AM
S O U ✌️ I K
S O U ✌️ I K - avatar