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