jQuery(document).ready(function ($) { $('#'+id).val(key); }); var id = 'subkey1'; var key = '8aba8e17f9a99b5114080e622105bd5c';