You are binding the event handler inline in HTML also you are using jQuery to bind again inside the function which is not correct.

Just remove the inline onclick,

<input type="button" id="ImageHosting" value="To Image Hosting" />

And change JS

$(document).ready ( function () {
    $("#ImageHosting").click(function () {
       alert("test");
    });
});

Incase if this button is inserted dynamically then,

$(document).ready ( function () {
    //replace document below with enclosing container but below will work too
    $(document).on('click', "#ImageHosting", function () {
       alert("test");
    });
});

Use .live/.delegate if you older version of jQuery ( < 1.7)

Answer from Selvakumar Arumugam on Stack Overflow
🌐
W3Schools
w3schools.com › js › tryit.asp
W3Schools Tryit Editor - JavaScript Alert
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
SitePoint
sitepoint.com › javascript
onclick="javascript:alert('a')" vs. onclick="alert('a')" - JavaScript - SitePoint Forums | Web Development & Design Community
November 18, 2011 - Hi All, Are there any benefits to doing : onclick=“javascript:alert(‘a’)” vs. onclick=“alert(‘a’)” Secondly, how do I search for this on the net? I’m not able to come up with search terms that generate any good result…
🌐
EDUCBA
educba.com › home › software development › software development tutorials › javascript tutorial › javascript onclick alert
JavaScript onclick Alert | How does JavaScript onclick Alert work?
October 18, 2022 - We have created the onclick() function and alert() function on same program the html tag elements like button etc will used to create and designed for html web pages and it will call the JavaScript functions for authentication or validation purpose.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
CodePen
codepen.io › rezeaka › pen › WoKjKB
onclick-alert
<button onclick="show()">Click Me</button> ! CSS Options · Format CSS · View Compiled CSS · Analyze CSS · Maximize CSS Editor · Minimize CSS Editor · Fold All · Unfold All · ! JS Options · Format JavaScript · View Compiled JavaScript · Analyze JavaScript · Maximize JavaScript Editor · Minimize JavaScript Editor · Fold All · Unfold All · function show() { alert("You clicked on the button, so it triggered the alert box"); } !
🌐
Codecademy
codecademy.com › forum_questions › 512d28a06918338f2300e9ea
How to make a html button clickable and to show alert on it ? | Codecademy
<script> function clickAlert() { alert("Alert!"); } </script> <input type="button" onclick="clickAlert()" value="Click-2-Alert">
🌐
University of Washington
washington.edu › accesscomputing › webd2 › student › unit5 › module2 › lesson1.html
Lesson 1: Using JavaScript to Show an Alert
Try this: Remove the ... code adds a button to your web page. The button includes the onclick attribute, which causes the showAlert() to be called when a user clicks the button....
Find elsewhere
🌐
Indiana
info.sice.indiana.edu › ~hrosenba › Demo › javascript › 6alert.html
Alert and Confirm
In the examples where the code is triggered by a button click, the entire code must by contained in quotation marks: onClick="alert( 'Your Message Here...' )" Without the "onClick" syntax, the outside quotation marks are unnecesssary and will cause an error so they should be left out: alert( ...
🌐
W3Schools
w3schools.com › html › tryit.asp
W3Schools Tryit Editor - The button Element
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
W3Schools
w3schools.com › jsref › event_onclick.asp
onclick Event
addeventlistener() alert() atob() blur() btoa() clearInterval() clearTimeout() close() closed confirm() console defaultStatus document focus() frameElement frames history getComputedStyle() innerHeight innerWidth length localStorage location matchMedia() moveBy() moveTo() name navigator open() opener outerHeight outerWidth pageXOffset pageYOffset parent print() prompt() removeEventlistener() resizeBy() resizeTo() screen screenLeft screenTop screenX screenY scrollBy() scrollTo() scrollX scrollY sessionStorage self setInterval() setTimeout() status stop() top Window Console
🌐
Quackit
quackit.com › html › html_editors › scratchpad
javascript alert box onclick
Preview HTML code with this online HTML viewer. javascript alert box onclick.
🌐
IncludeHelp
includehelp.com › code-snippets › display-alert-message-on-button-click-event.aspx
Display Alert Message on Button Click Event using JavaScript
<!--Display Alert Message on Button Click Event.--> <html> <head> <title>Display Alert Message on Button Click Event.</title> <script type="text/javascript"> function showMessage() { alert("Hello friends, this is message."); } </script> </head> <body> <center> <h1>Display Alert Message on Button Click Event.</h1> <b>Click on button to display message: </b><br /> <br /> <input type="button" id="btnShowMsg" value="Click Me!" onClick="showMessage()" /> </center> </body> </html> Result: Click for DEMO → ·
🌐
Sololearn
sololearn.com › en › Discuss › 2801433 › onclick-alert-functions-in-js
Onclick Alert Functions In JS | Sololearn: Learn to code for FREE!
So I finished learning Javascript (I didn't learn it on Sololearn I learned it on a different coding platform) and JQuery a while ago, but I forgot how to use the onclick function that outputs an alert when you click an HTML button.