I'm trying to change the contents of the value of the hidden input, but for some reason it does not change, maybe something is wrong?

<script> $(document).ready(function(){ var fieldID = 38; var newValue = '<?php echo strip_tags($expertiza); ?>'; $('#nf-field-' + fieldID).val(newValue).trigger('change'); }); </script> 

    1 answer 1

    The solution was found on the same day.

     $( ".p-btn a" ).click(function() { var subj = $( this ).parent("p").prevAll('.process-exp-head:first').find(".process-exp-e").text(); $("#nf-field-38").val($.trim(subj)); console.log($("#nf-field-38").val()); });