I make a page in asp.net MVC .In this page exist a View and a PartialView.I put button into partialview and write Countinue function into View.
button:
<button type="button" class="btn btn-warning center-block btn-large" id="Continue" onclick="Continue(this);">Continue</button>
js:
var Continue=function (e) {
e.preventDefault();
if ($('#FieldsetCharterFlightsReturn article').size() < 1) {
if (validateDeparturef(e)) {
$("#CharterFlightsForm").submit();
}
}
if ($('#FieldsetCharterFlightsReturn article').size() > 0) {
if (validateDeparturef(e) && validateArrivalf(e)) {
$("#CharterFlightsForm").submit();
}
}
};
Now When i click on the button get this error:
TypeError: Continue is not a function
What is right way to bind event of elements into PartialView?
thiswhich will be the button and it will not have a method calledpreventDefault()console.log("This function exist");just above your function definition, run your page and verify that message appear in the browser console.function Continue()also you need to passeventlikeonclick="Continue(event);"