Trying to pull text from one field and put it into a button text Trying to pull text from one field and put it into a button text

I have a page that I can use merge fields from a CMS to dynamically adjust content; however, this functionality doesn't work with button text. Therefore, I need to use a normal text field and then take the value from that field and push it to the button text.

I thought this would work, but something it's not working right. Can anyone help me figure out what I am doing wrong?

<div id="ctatext" class="ctabutton">Request Pricing</div>
<input type="submit" value="Get Started" data-wait="Please wait..." id="ctabutton" class="_2-0-yellow-btn-2 request w-button">

<script>
    $(document).ready(function () {
    let btntext = $('.ctabutton').text();
    $('input._2-0-yellow-btn-2 request w-button').val(btntext); 
});
</script>


from Stackoverflow

Comments

Popular posts from this blog

How to extract items from a subarray and push them to the main array

Detox gets stuck on JS Timer/Main Run Loop when registering a lot of screens with React Native Navigation Detox gets stuck on JS Timer/Main Run Loop when registering a lot of screens with React Native Navigation

\\u0000 cannot be converted to text error \\u0000 cannot be converted to text error