Skip to content
xanadiu edited this page Apr 23, 2017 · 5 revisions

Data Attributes

By looking at the files in the gem you will see that you can easily add some attributes to the recaptcha. Perhaps you want to have a data-callback to trigger some javascript when the checkbox is clicked?

Available data attributes

  • badge
  • theme
  • type
  • callback
  • expired_callback
  • size
  • sitekey
  • id

How to use

Simply add them as optional parameters to the recaptcha:

<%= recaptcha_tags(callback: 'recaptcha_callback', id: 'boogie', sitekey: 'blahblahblahblah' ) %>

This produces a recaptcha like this:

<div class="g-recaptcha" data-callback="recaptcha_callback" data-sitekey="blahblahblahblah" id="boogie">