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