When utilizing the onclick attribute in the HTML markup without using a partial tag, the onclick function is functional. However, when the exact same markup is used within a partial, the onclick function fails to execute.
Query: Is there a method to make the onclick function work with a partial HTML element, or must the markup be written traditionally?
This snippet shows my partial Submit button:
<input type="submit" value="Submit" class="button1" />
Below is my JavaScript Confirm function:
function Confirm(message, okayMessage, cancelMessage) {
var result = confirm(message);
if (result == true) {
alert(okayMessage);
} else {
alert(cancelMessage);
}
}
Here is where I call the onclick function, incorporating the partial button and Confirm script:
<partial name="_SubmitButton" onclick="Confirm('Are you sure you want to delete this skill?', 'Skill has been deleted', 'Skill was NOT deleted')" />
Lastly, here is the reference to the stylesheet at the end of my markup (which is functioning as expected):
@section Scripts{
<script type="text/javascript" src="~/js/Popups.js"></script>
}