Posts by Wérick Vieira • 66 points
5 posts
-
0
votes0
answers30
viewsQ: Some way to allow loading of script inserted by dangerouslySetInnerHTML
function createMarkup(str) { return { __html: str }; } function GraphicLarge({ HTMLData }) { return ( <div className="graphic graphic--lg"> { isFetching ? <div…
-
2
votes2
answers1105
viewsA: JAVASCRIPT: Sort HTML list by name and age
function getNumber(str) { return +str.textContent.match(/\d/gi).join('') } function orderIdade() { const list =…
-
1
votes1
answer211
viewsA: How to Do This in Javascript (Listing Products by Category, According to Database)
Hello, you can use reduce to create a new array grouped by categories. See the example below: var dados = [ { nome: 'cerveja', categoria: 'bebida' }, { nome: 'suco', categoria: 'bebida' }, { nome:…
-
1
votes3
answers156
viewsA: How can I capture the names of an html form and put in a variable in Javascript
Well, if you want to capture the name attribute of the input tag, it would look like this : var campo = document.querySelector("input:nth-child(1)"); var nameCampo = campo.getAttribute("name");…
-
1
votes3
answers1272
viewsA: How to add multiple elements within jQuery’s html() function?
This method only accepts a string with argument. I believe you have received a parseHTML error. You could assemble a string this way: var str = ""; str += "<div id='meuId'>; str += "<div…