I am trying to change the id of a div at runtime, but getting the error. Its a aspnet core program, so the @1 value is a dynamic value that translates to an integer value e.g. 1
Uncaught TypeError: $(...).parent(...).closest(...).id is not a function
<input required class="form-control" maxlength="15" type="text" data-val="true" data-val-length="The field Username must be a string with a minimum length of 6 and a maximum length of 50." data-val-length-max="50" data-val-length-min="6" data-val-required="Please enter your chosen Username" id="Username" name="Username" value="" />
<input required class="form-control" maxlength="50" type="text" data-val="true" data-val-length="The field First_Name must be a string with a minimum length of 2 and a maximum length of 50." data-val-length-max="50" data-val-length-min="2" data-val-required="Please enter the first name" id="First_Name" name="First_Name" value="" />
<input required class="form-control" maxlength="50" type="text" data-val="true" data-val-length="The field Last_Name must be a string with a minimum length of 2 and a maximum length of 50." data-val-length-max="50" data-val-length-min="2" data-val-required="Please enter the last name" id="Last_Name" name="Last_Name" value="" />
I have this ajax post which worked when I used test values
However on changing it to real meaningful values (e.g I used my family names as return values) After changing it to (Output, SQuantity, Output and total) it stopped working. Here is my code below
I started using jquery feb this 2018 and have been using it with visual studio and Microsoft MVC .NetCore
However I have a few questions,
Visual studio by default puts version 1..x in all developed pages and I was reading the docs on the jquery website and it says version jQuery 3.3.1 is out and versions 1x and 2x will not be receiving patches anymore
I take it that I must upgrade and the versions 3x are backward compatible to my projects ?
I don't want to use a form button submit event, as I am using (MVC reusable partial pages) so I want the jquery validation with control. In some instances these partial pages appear as modal popups
How do I focus on the required fields and enable the custom error messages.
Here is my code
$('#Button_Lists_Submit').click(ehi); // calls the validation code below
var Submit_Form = function () {
debugger var data = $('#List_Form').serialize();
if ($('#List_Form').valid) {
ehi(); // call an ajax post here (which I already have in my code)
} else {
return false;
form.focusInvalid() // focus on the form errors as this DOES NOT WORK }
}
function ehi(e) { e.preventDefault()
var fd = new FormData($("#List_Form")[0]);
var form = $('#List_Form'); form.validate(); if (!$('#List_Form').valid()) { alert('Model is not valid -' + form.valid());
I am using JCROP to crop images and applying a css filter to it. However when the canvas (image) is cropped, it loses its css, (ie the User chosen filter is lost)
However if I call the same function via button click it works, but not with jcrop
Here is my code
Ehi
function CanvasCropCSS() { // THIS IS CSS FILTER FUNCTION
$("#canvas").removeClass();
var t = $("#Hidden_Filter").val(); //It gets the value of the applied filter from a hidden field
alert(t);
// $("#canvas").AddClass($(('#Hidden_Filter').val()); // This only works when applied to a button event
I am struggling with conflicting Jquery scripts, using asp.net mvc core 2. Whenever I add the layout page which has its own jquery library for bootstrap it gives the error (JCrop is undefined) If I block jquery in the inspect tool in chrome, it works.
What can I do ? here is my code
The only difference between the two pages, is that the main page (line 5) has the reference default layout in .net MVC which is Layout = "~/Views/Shared/_Layout.cshtml";
Also I am attaching the chrome network order below