diff --git a/dist/js/index.js b/dist/js/index.js
index 4bd668b..d779c11 100644
--- a/dist/js/index.js
+++ b/dist/js/index.js
@@ -33,7 +33,7 @@
var setCaptcha = function setCaptcha($el, options, shouldReset) {
if (!shouldReset) {
$el.insertAdjacentHTML('beforebegin', "\n "));
- this.$captchaEl = document.querySelector(".".concat(options.canvasClass));
+ this.$captchaEl = $el.previousElementSibling;
this.$captchaTextContext = this.$captchaEl.getContext('2d');
this.$captchaTextContext = Object.assign(this.$captchaTextContext, options.canvasStyle);
}
diff --git a/dist/js/index.min.js b/dist/js/index.min.js
index 3a50a54..0d0e7fd 100644
--- a/dist/js/index.min.js
+++ b/dist/js/index.min.js
@@ -1 +1 @@
-!function(t,e){void 0===t&&void 0!==window&&(t=window),"function"==typeof define&&define.amd?define([],function(){return t.jCaptcha=e()}):"object"==typeof module&&module.exports?module.exports=e():t.jCaptcha=e()}(this,function(){"use strict";function t(){i=Math.round(8*Math.random())+1,n=Math.round(8*Math.random())+1,c=i+n}function e(t,e,a){a||(t.insertAdjacentHTML("beforebegin",'\n ')),this.$captchaEl=document.querySelector(".".concat(e.canvasClass)),this.$captchaTextContext=this.$captchaEl.getContext("2d"),this.$captchaTextContext=Object.assign(this.$captchaTextContext,e.canvasStyle)),this.$captchaTextContext.clearRect(0,0,e.canvasStyle.width,e.canvasStyle.height),this.$captchaTextContext.fillText("".concat(i," + ").concat(n," ").concat(e.requiredValue),0,0)}function a(t){var e=0\n \n ')),this.$captchaEl=t.previousElementSibling,this.$captchaTextContext=this.$captchaEl.getContext("2d"),this.$captchaTextContext=Object.assign(this.$captchaTextContext,e.canvasStyle)),this.$captchaTextContext.clearRect(0,0,e.canvasStyle.width,e.canvasStyle.height),this.$captchaTextContext.fillText("".concat(c," + ").concat(n," ").concat(e.requiredValue),0,0)}function a(){var t=0
`);
- this.$captchaEl = document.querySelector(`.${options.canvasClass}`);
+ this.$captchaEl = $el.previousElementSibling;
this.$captchaTextContext = this.$captchaEl.getContext('2d');
this.$captchaTextContext = Object.assign(this.$captchaTextContext, options.canvasStyle);