I have external js script where for example I writing this code
$('#save').click(function () {
alert('Clicked');
});
In view I have button
<div class="form-group" style="text-align:center">
<input type="button" id="save" value="Create" style="border-radius:30px; background: #1d69b4; border-color: #1d69b4;width: 250px; color: white;" class="btn btn-default" style="margin-right: 40px;" />
</div>
In header of View I put scripts like this
<script src="~/Scripts/jquery-3.2.1.js"></script>
<script src="~/Scripts/HTMLCanvas.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0rc1/jspdf.min.js"></script>
<script src="~/Scripts/PatientDatabaseScripts/AddingPatient.js"></script>
When I click button, it does nothing, any alerts. In dev console no errors.
But when I write alert via function , and in button put code onclick = "save()", all okay.
Where is my problem?
saveactually is? aspnet renames the ID of Controls dynamically. Google whatClientIDorClientIDMode="Static"do