Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Basic JavaScript/JQuery Function Not Working for No Reason

My teammate and I have been tirelessly working at this seemingly impossible bug with js/jquery. We have a simple function called feedback in our .js file, but it is not working. See our replit link below:

https://replit.com/join/pryxsdvjtz-5pengoo

Please help.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Edit: Here’s the function:

function feedback(event) {
  event.preventDefault();
  console.log("this function ran");
  var text = $('#text');
  console.log(text);
}

I’ve reduced a lot of its functionality for debugging purposes but all I want it to do is print "this function ran" in the console. Thank you!

>Solution :

This is because I think, replit is not redirecting to create.html which you can verify from the url in the mini browser window. I feel this is how the replIt works. Whereas, if you tried in new tab you can see create.html in the url as a path. If the create.html is not loaded, then your script is also not loaded right. So, your function is not executed.

In the top right corner of the browser preview window in replit there is one option for opening the url in new tab. The code you posted works there. It is not working in the preview-browser-window. So there is nothing wrong with your code.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading