I’ve posted a similar question regarding switching HTML text snippets (see JS Switch HTML content based on specific text included in h1 tag), for which the replies were hugely helpful. From these replies, I used the following code to change the HTML text snippet: I now wish to modify the code to change the img src depending on some text
Tag: include
Check if url contains blacklisted strings javascript
If i have an array of blacklisted words like so: and I’d like to check if myLink I got through a.getAttribute(“href”) contains one of those words what’d be the best way to go? Right now i’m trying this but it doesn’t work: full section: Answer Are you in a situation where you’re unable to use Array.prototype.findIndex? (I.e. you must support
Can’t I put my javascript files outside html public folder?
I’m following this tutorial to create a safe login system. My folder logic is as follows: When I say “as stated on the tutorial”, I refer to this passage: Store your copy of this file in a directory called “js”, off the root directory of the application. Did I interpret it right? Should js folder be inside html, instead of
How to call php file into a div?
I’m trying to reload only specific div Because div content is much larger, I tried: How can I call the code from a .php file into a div ? Answer use $(‘div’).load(‘phpfile.php’) $.load is used to load data from the server via an html file or a server-side script like php. Just to have an overview of what you can
How do I include a JavaScript file in another JavaScript file?
How do I include a JavaScript file inside another JavaScript file, similar to @import in CSS? Answer The old versions of JavaScript had no import, include, or require, so many different approaches to this problem have been developed. But since 2015 (ES6), JavaScript has had the ES6 modules standard to import modules in Node.js, which is also supported by most