Skip to content Skip to sidebar Skip to footer

Amend Javascript To Also Remove String

$(document).on('knack-view-render.view_335', function (event, view, data) { $('#field_134').attr('maxLength', 26); }); currently use the above code to restrict the length of the i

Solution 1:

As I did not know you custom event, I just came up with this

$(document).on("knack-view-render.view_335", function (event, view, data) {
let input = $('#field_134');
let inputted = "";
let notAllowed1 = "in stock";
let notAllowed2 = "is in stock";

input.attr('maxLength', 26);
input.on("change paste keyup", function() {
inputted = $(this).val(); 
if (inputted.includes(notAllowed1 || notAllowed2)) {
  $(this).val("AMEND INPUT")
};
});
});

Post a Comment for "Amend Javascript To Also Remove String"