Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  12] [ 2]  / answers: 1 / hits: 78220  / 12 Years ago, fri, march 30, 2012, 12:00:00

I am trying to invoke a button click from inside a .cshtml file:



  <input type=button id=ImageHosting value=To Image Hosting onclick=ImageHosting_Click()/> 


This is the .js file:



 function ImageHosting_Click() {
$(#ImageHosting).click(function () {
alert(test);
});
}


I am not able to get the alert message. Any idea why?


More From » jquery

 Answers
12



// Try like this:

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

<script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js></script>
<input type=button id=ImageHosting value=To Image Hosting />




[#86502] Thursday, March 29, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kamronr

Total Points: 749
Total Questions: 110
Total Answers: 122

Location: Dominica
Member since Sat, Nov 5, 2022
2 Years ago
kamronr questions
Mon, Dec 21, 20, 00:00, 3 Years ago
Fri, Oct 16, 20, 00:00, 4 Years ago
Sat, Oct 3, 20, 00:00, 4 Years ago
Sun, Jul 28, 19, 00:00, 5 Years ago
;