Skip to content

Instantly share code, notes, and snippets.

@subramanian-vv
Last active December 29, 2020 18:12
Show Gist options
  • Save subramanian-vv/8466ad58c664e5fc0b736b8af9ff1bb0 to your computer and use it in GitHub Desktop.
Save subramanian-vv/8466ad58c664e5fc0b736b8af9ff1bb0 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Weather App</title>
</head>
<body style="background-color: bisque; font-size: large;">
<form class="input">
<div class="form">
<label for="name">Enter city name: </label>
<input type="text" id="city" required />
</div>
<br>
<button type="submit">
Get Weather
</button>
</form>
</body>
<script>
const {ipcRenderer} = require("electron");
const form = document.querySelector("form");
//Handles form submission
form.addEventListener("submit", (e) => {
e.preventDefault();
const city = document.querySelector("#city").value;
ipcRenderer.send("city:find", city);
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment