// Wrap the jQuery code inside a self-executing function
(function ($) {
$(document).ready(function () {
// Get the full URL
var url = window.location.href;
// Find the position of the ‘#’ character
var hashIndex = url.indexOf(‘#’);
// Extract everything after ‘#’ if it exists
var serienummer = (hashIndex !== -1) ? url.substring(hashIndex + 1) : ”;
// Set the extracted value to the input field
$(‘#serienummer’).val(serienummer);
});
})(jQuery); // Pass ‘jQuery’ as an argument to the self-executing function