Can anyone help me with copying text from a heading to an input value? Here's an example:
<h2 class="customTitleHead">This is a Heading</h2>
I want to transfer the text from the heading into an input field like this:
<input type="text" value="" name="rProvider" class="rr_small_input" />
The desired output should be the text from the heading inside the input value:
<input type="text" value="This is a Heading" name="rProvider" class="rr_small_input" />
I've attempted to use the following code, but my input remains empty:
jQuery(function () {
jQuery(".rr_small_input[name='rProvider']").val(jQuery("h2.customTitleHead").val());
});