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

With jQuery, how to automatically select the value of an input text that has been modified with the arrows? With jQuery, how to automatically select the value of an input text that has been modified with the arrows?

Cannot create an instance of a defined class in Javascript Cannot create an instance of a defined class in Javascript

Using Ts-Standard linting, JSDoc comment at beginning of file triggers "This rule requires the `strictNullChecks` compiler option" error Using Ts-Standard linting, JSDoc comment at beginning of file triggers "This rule requires the `strictNullChecks` compiler option" error