Is it possible to make HTML & CSS buttons run a C++ function?

Question:
Is it possible to make HTML & CSS buttons run a C++ function when pressed?

HTML


<button onclick="function1()" class="button1">Login</button>

C++

#include <IOStream>
using namespace std;

int function1(){
//Something that affects the html & css if that exists
}

int main(){
return 0;
}

Thanks For Reading.

https://www.phind.com/search?cache=et2bz6x03h9ib05tosvrs174

I’ll edit this with a Repl you can fork in a bit

1 Like

Thanks :smiley:

It’s gonna take me a while to learn this lol.

1 Like

Ugh… please don’t quote that whole thing, just reply to it.

aaa no I really dislike trying to get anything to work on Replit :sob:

so you have to install bunch of libraries and it’s late and I’d rather not

someone smarter than me can make it work, but basically:

  • make c++ server that does the thing you want it to do at a certain route
  • use js to fetch that

@HenryMiles3 may I ask why you’re using C++ instead of JS?

Prob just a choice (I can’t remember lol) and other personal reasons.

Do you know where I could learn the code which would actually execute something that effects the HTML & CSS?