Files
gallery3/modules/gallery/js/albums_form_add.js
shadlaws b3984f975a #2054 - Revise albums_form_add.js: update for new jQuery, refactor.
- changed "change" event to "input" to catch cut'n'paste
- kept "keyup" event for old IE compatibility
- removed code duplication by using $(this) and combining events using .on()
- replaced attr("value",...) with val()
- added quotes around input names
2013-03-12 10:10:47 +01:00

7 lines
334 B
JavaScript

$("#g-add-album-form input[name='title']").on("input keyup", function() {
$("#g-add-album-form input[name='name']").val(
$(this).val().replace(/[\s\/\\]+/g, "-").replace(/\.+$/, ""));
$("#g-add-album-form input[name='slug']").val(
$(this).val().replace(/[^A-Za-z0-9-_]+/g, "-").replace(/^-+/, "").replace(/-+$/, ""));
});