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 can I get every LI element's innerHTML and display as string? How can I get every LI element's innerHTML and display as string?

Selenium: Cannot click element Selenium: Cannot click element

Full text search does not find some specific words, which not included in stop words Full text search does not find some specific words, which not included in stop words