mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 11:29:24 -04:00
- 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
7 lines
334 B
JavaScript
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(/-+$/, ""));
|
|
});
|