On my website, I have two input fields: Title and Stock Code. I have two goals:
I found this tutorial that explains how to make the first goal. Here is my working example:
http://jsfiddle.net/2gezC/1/
In the second part, itβs hard for me to find a tutorial on removing characters in jQuery, since most of the tutorials are for JavaScript.
I found this tutorial and tried to integrate it into my code as follows:
(function ($) {
$(document).ready(function () {
$('input#edit-title-fragment').keyup(function () {
var str = $(this).val();
str = str.replace(/[^a-zA-Z 0-9]+/g, '');
var txtClone = $(this).val();
$('input#edit-sku-fragment').val(txtClone);
});
});
})(jQuery);
. - , . !