In the Stripe documentation, the example form shows the following input
<input type="text" size="20" data-stripe="number"/>
I'm using the following code in ruby (rails 4) to generate my input
<%= text_field_tag :card_number, nil, name: nil, :placeholder => "Card Number" %>
which generates
<input id="card_number" placeholder="Card Number" type="text" />
However, I'm unable to add the data-stripe attribute. I guess I could always add the field manually and not use rails feature. However, it'll be tedious to replace other functions such as select_year
and select_month
. So, how can I add a custom attribute when generating an input using rails? Specifically, data-stripe="number"
<%= text_field_tag :card_number, nil, name: nil, placeholder: "Card Number", data: { stripe: 'number' } %>
What I think you’re after.
Have you tried something like this?
<%= text_field_tag :card_number, nil, name: nil, :placeholder => "Card Number", "data-stripe" => 123 %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With