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