dom

Recaptcha 2.0 error: reCAPTCHA placeholder element must be an element or id

倖福魔咒の 提交于 2020-06-13 07:00:51
问题 I've looked at every other post I could find, and none of them resolved the issue for me. I have a single call to the ReCaptcha API in my document head: <script src="https://www.google.com/recaptcha/api.js?hl=he-IL&onload=onloadCallback&render=explicit" type="text/javascript"></script> And then immediately after var onloadCallback = function() { grecaptcha.render("recaptcha2", { sitekey: "6LendPIUAAAAAGQqB_2tq8fpgdGfBnEQA3v-CB0g", theme: "light" }); }; And I get the following error in my

Recaptcha 2.0 error: reCAPTCHA placeholder element must be an element or id

限于喜欢 提交于 2020-06-13 07:00:41
问题 I've looked at every other post I could find, and none of them resolved the issue for me. I have a single call to the ReCaptcha API in my document head: <script src="https://www.google.com/recaptcha/api.js?hl=he-IL&onload=onloadCallback&render=explicit" type="text/javascript"></script> And then immediately after var onloadCallback = function() { grecaptcha.render("recaptcha2", { sitekey: "6LendPIUAAAAAGQqB_2tq8fpgdGfBnEQA3v-CB0g", theme: "light" }); }; And I get the following error in my

Recaptcha 2.0 error: reCAPTCHA placeholder element must be an element or id

假如想象 提交于 2020-06-13 07:00:11
问题 I've looked at every other post I could find, and none of them resolved the issue for me. I have a single call to the ReCaptcha API in my document head: <script src="https://www.google.com/recaptcha/api.js?hl=he-IL&onload=onloadCallback&render=explicit" type="text/javascript"></script> And then immediately after var onloadCallback = function() { grecaptcha.render("recaptcha2", { sitekey: "6LendPIUAAAAAGQqB_2tq8fpgdGfBnEQA3v-CB0g", theme: "light" }); }; And I get the following error in my

Detect when a node is deleted (or removed from the DOM because a parent was)

北战南征 提交于 2020-06-12 04:52:26
问题 I want to detect when a node (nodeX, say) is no longer available, either because it was deleted or because its parent (or its parents parent) was deleted. So far, all I can think of is to use Mutation Observer to see any deletions on the page, and check if the deleted nodes was nodeX or had nodeX for a descendant. Is there an easier way? Please note: as far as I understand, the linked question (that this question "is a duplicate of") asks "how can I detect a [direct] deletion of a node". Mine

Functional programming and DOM manipulation

余生颓废 提交于 2020-06-10 03:36:50
问题 How is most "pure" way to manipulate DOM in script written in "functional" way. For example if I simply need to change element width should I use typical syntax like: document.querySelector(".class").style.width = ... or write dedicated function, like: function resize(el, w) { return el.style.width = w; } resize(document.querySelector(".class", 100)); I think, I understand general idea of functional programming but all examples I encountered are focused on manipulating numbers or strings.

Get HTML element via aria label

半城伤御伤魂 提交于 2020-06-10 02:51:27
问题 I'm making a small chrome extension and for it I need to grab a div from the DOM to manipulate. I get the DOM but I'm having trouble grabbing the required div . Here's the code for it. <div id=":ik" class="Am Al editable LW-avf" hidefocus="true" aria-label="Message Body" g_editable="true" role="textbox" contenteditable="true" tabindex="1" style="direction: ltr; min-height: 137px;"><br></div> I've tried getElemenyByID , and document.attrib but both return null . Any advice on how to get the

How to listen for custom events defined web component

不问归期 提交于 2020-06-09 11:36:05
问题 I have a custom element my-checkbox that wraps a checkbox, label, styling, etc. When that checkbox is toggled I am defining a CustomEvent named check within my constructor, like so: constructor(){ super(); this._shadowRoot = this.attachShadow({mode: 'open'}); this.checkEvent = new CustomEvent("check", { bubbles: true, cancelable: false, }); } I dispatch that event when the checkbox is toggled: toggleCheckbox(){ this.dispatchEvent(this.checkEvent); console.log(this.checkEvent); ... } I infer

namespace attributes not present in .outerHTML

*爱你&永不变心* 提交于 2020-06-01 05:25:43
问题 In HTML5/JavaScript, if I create a namespaced dom node programmatically, like so: svgElt = document.createElementNS("http://www.w3.org/2000/svg", 'svg') the node 'knows' it's own namespace, which I can retrieve like so: svgElt.namespaceURI // result: "http://www.w3.org/2000/svg" But the namespace is not treated as a "normal" attribute: svgElt.getAttribute('xmlns') // result: null So the behavior of the programmatically created node is different from the equivalent "straight" node <svg xmlns=

how to use same script.js file for calling different CSS class using multiple Ids

本秂侑毒 提交于 2020-05-30 09:23:11
问题 I've made a page where same donut chart will come 4 times. And there size will be same. But there position will be different. One should take atleast 20px space from another. For this, I've written 4 css style. But when i try to call them using same script.js they are not working but when i added a new script2.js with changing the id name it works. For this i had to make 4 script.js whose works is same. var myCanvas = document.getElementById("myCanvas1"); myCanvas.width = 50; myCanvas.height

how to use same script.js file for calling different CSS class using multiple Ids

ε祈祈猫儿з 提交于 2020-05-30 09:20:52
问题 I've made a page where same donut chart will come 4 times. And there size will be same. But there position will be different. One should take atleast 20px space from another. For this, I've written 4 css style. But when i try to call them using same script.js they are not working but when i added a new script2.js with changing the id name it works. For this i had to make 4 script.js whose works is same. var myCanvas = document.getElementById("myCanvas1"); myCanvas.width = 50; myCanvas.height