MV Learning javascript outside of RPG Maker

I want to build a tool to use in game development, but not to run inside RPG Maker itself. My vast knowledge of Javascript involves adding something to the RM core scripts - I've never made anything that runs without them.

What I want to do is have a web page with some UI elements, detecting clicks, adding images.

I'm after some guides that I can download to get me started. I won't have internet access so need to grab as much as I can tonight / tomorrow morning.

Any suggestions?
With your knowledge of JS you could probaly fly throught the webdesign section of freecodecamp in one night. I used that and feel like learning while doing is great for retention, their program is very good. As for offline resources, I'm not really sure.
Thank you - I'll go check it out now.
You can start by literally create an HTML page (through creating a new text file) and how to load javascript from that HTML page. Once you know how to do that, it opens up a whole new world.

As for the actual guide, I don't have any. I don't watch the guide/read guide. I read docs. I searched as I need. So, offline learning is almost impossible for me

But for the resources. For a lightweight web page framework, I recommend grabbing vue.js https://v3.vuejs.org/guide/introduction.html#what-is-vue-js
And if you want your web page able to access local files (mostly for writing to a local folder), you either need NWJS or Electron. So, you might as well seek a tutorial on how to install/use them.

And now that you are going to walk on this path. You might as well try to look for how to use HTML tag or anything to build a user interface (like bootstrap or similar, IDK). Unfortunately, since my main job is as a back-end developer, I don't have much knowledge in this field.
I forgot to say, this tool will be run on a Wordpress page. I don't know if that makes any difference or not.

I just dragged out my old Javascript Definitive Guide that I bought when MV was first released, and it looks like it will come in handy too. 1000+ pages of light reading ...
I don't know WordPress and how does it operate. But offline learning like I mentioned (creating an empty HTML page and how to load JS file) works as learning at a very basic level of web page building and javascript learning (you can learn how to create button and how JS script triggered when you press them, etc) that I believe will be useful anywhere else.

But now that you mentioned that you want to make a game dev tool in WordPress, what kind of tool you have in mind?
I want to redo the tileset builder that I made for Ace.
Depending on how complex your webpage is, you may need something like a Vue.js or React.js. Gatsby is actually a static site generator that can be used as a blog site, much like Wordpress.

But, seeing as it's your first web project, I imagine you want to keep it simple.

This page has a good breakdown.

You can get by with usage of plain Javascript for stuff like click events and using a jQuery-like pattern (without needing the jQuery library).

You say you want to detect clicks and the like, so you will be doing a lot of:

HTML:
HTML:
<a id="clickMeButton" href>I am a link </a>
JS:
JavaScript:
buttonToDetect = document.querySelector('a#clickMeButton');
const whenIGetClicked = () => {
    console.log("I've been clicked!")
};
buttonToDetect.addEventListener('click', whenIGetClicked);

If you need to do any Ajax requests, which is basically what happens when you want to send data someplace without refreshing the page (usually a loading screen is shown), I recommend you use the axios library, because it's simple and effective. But, I imagine Wordpress plugins will have you covered on that front, so you won't need to send any of those.

Also, I'd look into using a CSS framework like Bootstrap to help your site's visuals. You can write your own, but if you're just starting out, probably best to rely on their classes for any layout or style changes.

----

That's for web stuff, to deepen your JS knowledge, Eloquent Javascript and the You Don't Know JS book series are gold.
I did learn html and css a long time ago. I'm going to try this without any external libraries, just because I don't want the added complexity of having to learn and add them. The stuff I need is
pretty basic, and I won't be reading or writing anything from/to the computer.

Thanks for all suggestions. I've gone over some DOM/JS videos on YT and have enough to get started with. Let's see how far I get with that.
const buttonToDetect = document.querySelector('a#clickMeButton');
If I recall correctly, you don't have to use a query selector. If the tag uses "id", you can just reference it directly by the id. For example, just write clickMeButton
If I recall correctly, you don't have to use a query selector. If the tag uses "id", you can just reference it directly by the id. For example, just write clickMeButton
That's when you are within a JS framework. Try it in a browser console, it won't work.

I think you are referring to references in Vue or React.
That's when you are within a JS framework. Try it in a browser console, it won't work.

I think you are referring to references in Vue or React.
Screenshot_685.jpg

Screenshot_686.jpg
If I recall correctly, you don't have to use a query selector. If the tag uses "id", you can just reference it directly by the id. For example, just write clickMeButton
That's when you are within a JS framework. Try it in a browser console, it won't work
😮 Today I learned.

*goes to refactor old code*

seriously, when did they add this to the DOM? Last I checked, you had to do
JavaScript:
document.getElementById
. Then again, I don't manually query much anymore since React.

(i was totally mobile when I replied lol)

Edited my code above, he's right. You don't have to query for html tags with ids any more, only for classes.

So it DOES work, but it's a global variable. Lots of reasons why global variables aren't the best, so querying is still the safest bet.
Hmm, apparently you are really calling

JavaScript:
window.clickMeButton

which is apparently bad practice. Querying for the selector is the widely supported way to do it.
Hmm, apparently you are really calling

JavaScript:
window.clickMeButton

which is apparently bad practice. Querying for the selector is the widely supported way to do it.
I can understand the reason behind it. Web building often involves a lot of collaboration, which was the reason why IIFE and all javascript practices like this one are invented. Just in case if your DOM element has a similar name to other properties, you still can get your DOM element by querying it by id.

So, unless you're making a collaboration work or want to release a framework, you can just hack and use it as you like, as long as you know what you're doing. That is my personal take in the matter.
Yeah, I freelance web development all the time, so my code is often code reviewed by my team. I wouldn't want to use it in a situation like that.

It is supported by all major browsers, so it's really a matter of preference and not tripping yourself up.

I tend to avoid global variables like the plague, though
I want to build a tool to use in game development, but not to run inside RPG Maker itself. My vast knowledge of Javascript involves adding something to the RM core scripts - I've never made anything that runs without them.

What I want to do is have a web page with some UI elements, detecting clicks, adding images.

I'm after some guides that I can download to get me started. I won't have internet access so need to grab as much as I can tonight / tomorrow morning.

Any suggestions?
It may (or may not) have been said already because I'm too lazy to read through all the replies, but given that you have a solid foundation for understanding the basics of JS (how to use variables, objects, functions, libraries, etc) you already have a pretty good leg up. I learned most of my web-based JS by googling stuff like "how to _____ in javascript," then clicking the MDN or StackOverflow link. To point you in roughly the right direction, based on what you specifically mentioned:

Detecting clicks:

someHTMLElement.addEventListener("click", someOnClickFunction);

function someOnClickFunction(e)
{
console.log("This was inside the clicked element: " + e.currentTarget.innerHTML);
};

Adding images:
Lots of ways to do this really, anything from using the canvas element to a nice, low-effort innerHTML, like so:

someHTMLElement.innerHTML = "<img src='butts.jpg' />";

Also might be useful:

// HTMLElement you want to create dynamically
let x = document.createElement("div");

// get existing element with id tag property "whatever"
let y = document.getElementById("whatever");

// add your new HTMLElement x to existing HTMLElement y
y.appendChild(x);

// set an HTMLElement's id tag or other attribute
x.id = "whatever"; // easier
x.setAttribute("id", "whatever"); // safer

Original thread: https://forums.rpgmakerweb.com/threads/learning-javascript-outside-of-rpg-maker.133133/