You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

技术求助:如何将指定提交按钮文本从Complete Purchase改为Place Order

How to Change the Submit Button Text from "Complete Purchase" to "Place Order"

Hey there! Let's get that button text updated for you. Depending on your setup, here are a few straightforward solutions:

1. Directly Modify the Static HTML

If you have access to the raw HTML code, just update both the value attribute and the data-disable-with attribute to "Place Order"—this keeps the text consistent whether the button is active or disabled during submission. Here's the modified code:

<input type="submit" name="commit" value="Place Order" class="btn btn-primary" id="js-payment-btn" data-disable-with="Place Order">

2. Dynamically Update with JavaScript

If you can't edit the HTML directly (like if it's generated by a CMS or framework), use JavaScript to target the button by its ID and update the text on the fly:

// Grab the button element
const paymentBtn = document.getElementById('js-payment-btn');

// Update the visible button text
paymentBtn.value = 'Place Order';

// Update the text that shows when the button is disabled
paymentBtn.dataset.disableWith = 'Place Order';

You can run this code on page load, or trigger it whenever you need to change the button text dynamically.

3. If You're Using Rails (since data-disable-with is a Rails UJS feature)

If this button is part of a Rails form, you don't need to manually set the data-disable-with attribute—Rails handles that automatically when you update the submit tag's text. For example:

<%= submit_tag "Place Order", class: "btn btn-primary", id: "js-payment-btn" %>

This will render the button with both value="Place Order" and data-disable-with="Place Order" out of the box.

That should cover all common scenarios. Let me know if you hit any snags!

内容的提问来源于stack exchange,提问作者Hamiz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:36:01