Posts by Sam • 79,597 points
3,121 posts
-
0
votes4
answers96
viewsA: Dropdown with Javascript
You don’t even need the class .untuggle. If the elements are already invisible with ul display: none, just add/remove the class .toggle. When you click on an item, that menu opens and another menu…
-
2
votes1
answer187
viewsA: Javascript does not work on Safari
It shouldn’t be working even in Chrome (or any other browser), because you’re comparing an element to a string, see: if (camposoma == "2 2 50 Almoço") { The variable camposoma was previously…
-
2
votes2
answers224
viewsA: Check if there is a percentage symbol (%) next to the number
Turns out you’re using the .includes() the object of the element and not its value, so the error. In doing: var taxas = $("#formaTaxas").val("0.00"); You are changing the value of the element…
-
1
votes2
answers213
viewsA: How to make Ckeditor mandatory to fill in as a required attribute
First you have to assign the plugin to a variable: var editor = CKEDITOR.replace('cumprimentos', {... Note that now the Ckeditor instance has a name, editor. Then you use the event required editor.…
-
3
votes2
answers377
viewsA: Game of popping polka dots on the screen
Create an array and add objects with 3 information: {p1, p2, id_da_bola} The p1 is position X, the p2 position Y and the id_da_boa an id to identify the ball. Use a for to go through the array…
-
1
votes1
answer89
viewsA: Scrolltop position()
Save the position in a sessionStorage (temporary cookie that will be deleted when leaving the page) and check if it exists and is different from 0 when the page is reloaded. Then use the method…
-
1
votes1
answer1697
viewsA: Javascript runtime error: Unable to get the indefinite or null reference style property
Use the method .hide() jQuery (since you are using $.ready) for the element panelActivex and in the element visitorImage you change class also with jQuery: $(document).ready(function () {…
-
2
votes4
answers210
viewsA: Get post ID with Javascript
Take the parent div by class and then the element by tag article and finally the attribute id: var id = document.getElementsByClassName("representatives-list")[0] .getElementsByTagName("article")[0]…
javascriptanswered Sam 79,597 -
0
votes3
answers381
viewsA: Difference between Jquery.Append() and Jquery.Html()
The $.html() has two functions: 1) Return the internal HTML of an element: <div> <p>Parágrafo</p> <--- <a href="url">Link</a> | HTML interno <br> <---…
-
0
votes1
answer480
views -
1
votes1
answer214
viewsA: How do I sort my datatable id downwards?
To sort the first column in descending order, add the option order at component initialization: $('#na_datatable').DataTable({ "order": [[ 0, "desc" ]] }); The 0 represents the first column.…
-
0
votes4
answers1230
viewsA: Put smooth transition with Javascript
With Javascript you can use setInterval() changing the property opacity: function toggleDiv(divid){ var el = document.getElementById(divid); var transicao, t; clearInterval(transicao);…
-
1
votes2
answers322
viewsA: Doubts regarding a large string bursting the table td tag
Use the property word-break: break-all;. It will break long texts that can exceed the width of the element where it is, see: td{ word-break: break-all; } <table border="1"> <tr> <td…
-
3
votes2
answers83
viewsA: Fit li:Dropdown Menu
Instead of using :hover, sets the borders as default for the elements. Saves an event in CSS. For this, use the signal > (direct children) and the :not(:first-child) in ul to catch only the…
-
2
votes2
answers251
views -
0
votes1
answer15
viewsA: Fordata picking up empty form
It is not empty. It turns out that the console does not display the values. You can check the Formdata data in the console by converting it to array: $('#form_addNewImage').on('submit', function(e)…
-
3
votes1
answer160
viewsA: How to delete character by character from input when pressing the button?
Using the method .substr() you can change the field value by taking from the first character to the penultimate and reinserting into the field: .substr(0, elemento.value.length-1); Begins from 0 and…
-
2
votes2
answers777
viewsQ: What is the difference between the 'Outline' and 'border' properties?
Studying the property outline, I realized that it produces the same effect as property border, at least apparently, see: .span1{ outline: 1px solid blue; } .span2{ border: 1px solid blue; } <span…
-
1
votes1
answer45
viewsA: Blue input edge color stylization
Change the property outline-color of the element: outline-color: red; /* borda vermelha */ An example: input{ outline-color: red; } <input> But this way it will only work in Chrome. In other…
-
1
votes1
answer20
viewsA: Pass ID value through Toggle
To avoid repeating button ids, concatene the variable $c PHP in your ids: id="onoff<?php echo $c; ?>" And the for of label also: <label for="onoff<?php echo $c; ?>"> And you could…
-
0
votes1
answer40
viewsA: How do I leave the background with greyscale, but its elements in the same original color?
Can create a pseudo-element ::before in div.grayscale with the background and apply the filter only on it: div { border: 1px solid black; padding: 5px; margin: 5px; width: 600px; height: 600px;…
-
0
votes2
answers57
viewsA: Why are div "social network" leaving the div when I use float
Elements with float do not respect the height of the container where they are. In your case, you have 2 Divs inside the div.menu (container), and as each div occupies an entire row and the second is…
-
1
votes1
answer55
viewsA: While with Javascript grabbing images inside a folder
Instead of wearing while, you could use for and insert the HTML into the div. No for below, the value 10 is the amount of images you want to insert: document.addEventListener("DOMContentLoaded",…
-
1
votes2
answers73
viewsA: How to make the button always right at the top inside the div?
You would have to create another parent div and put the button inside it, not the scroll div that contains the paragraph. Then you will also have to change some properties. In the example below I…
-
0
votes1
answer42
viewsA: Non-responsive input with Menubar is minimized
When the menu wins the class .nested-menu when it is minimized, just add the property display: none in the input: .nested-menu input{ display: none; }…
-
0
votes2
answers46
viewsA: Return of a Checkbox to Javascript
You get nothing because the checkbox does not have the attribute value, only class, name, id and style. If you want to receive the "approved" value, include the attribute @value = "aprovado" in the…
-
1
votes2
answers54
viewsA: Hide and show content
Your code has many problems, one of them is the repetition of id="fecharlastid". An id must be unique on the page, there cannot be two elements with the same id. Another thing, even more serious, is…
-
1
votes1
answer55
viewsA: Difference of the same code with and without for()
Use for with selectors in jQuery doesn’t make much sense because jQuery has the flexibility to access multiple or all elements of a collection, something pure Javascript doesn’t usually do. For…
-
0
votes4
answers97
viewsA: Change image by clicking on radio input
You can do it in a more practical way using other resources, such as dataset, which is an attribute data-* and use Event handlers instead of multiple attributes onclick, still avoiding various…
-
1
votes2
answers82
viewsA: Use For in Javascript in an HTML concatenation
In addition to missing close the <select>, you could do the for of options once (since the same array comes data.codigos for all selects) instead of performing the same for several times…
-
3
votes2
answers72
viewsA: Merge two arrays with whitespace
Another way is by using .map() creating a new array: const array1 = ['lorem','ipsum','teste','','hello','','vol'] const array2 = ['lorem','ipsum','teste','array2Tes','','world','vol'] const newArray…
-
1
votes1
answer127
viewsA: Animate item to :Hover and return with other properties
Only with CSS is not possible because the :hover temporarily changes the properties of the element that returns to its original state after losing the :hover. With Javascript you can use the event…
-
0
votes3
answers99
viewsA: How to calculate the Javascript input value and the result appear in the alert?
In addition to operator error difference <> (the correct is != or !==), I would suggest changes to your code, starting with the removal of numerous attributes onclick. Instead of using 1…
-
3
votes2
answers110
viewsA: Mount "if"s according to criteria
First place the condition of status and a else where there will be another if for the condition of paid: <?php if($transaction->status == refunded): ?> <td><span class="badge…
-
1
votes2
answers63
viewsA: Make loop if condition hurt
A simple form, also using while and a function verifica which returns an object with two data: function verifica(n){ return { num: n, isan: !isNaN(n) }; ↑ ↑ caractere verifica se é um número: 'true'…
javascriptanswered Sam 79,597 -
1
votes2
answers43
viewsA: Change object class <i> within <a> tag
Send the this as a parameter for the function in onclick. The this represents the element that called the function, ie if you have more than one button, will be changed the button icon clicked. You…
-
0
votes1
answer330
viewsA: How to put scroll in Bootstrap Scroll?
Just use the event callback shown.bs.collapse (see doc) and scroll the screen with animate until the div that was opened: $(function(){ $('#collapseExample').on('shown.bs.collapse', function(){ var…
-
6
votes1
answer145
viewsQ: How to detect screen width smaller than height with CSS?
I have a div with position: fixed which occupies the entire screen and which is only displayed when the width of the screen is less than the height. With Javascript I can do this check and show or…
-
1
votes1
answer127
viewsA: Age tester
The mistakes are that .getFullYear() is with wrong syntax, everything is in lowercase: var ano = data.getfullyear() The other errors is that variable nasc already takes the value and you’re trying…
-
0
votes2
answers83
viewsA: Align menu to center
Do not use float left. This makes the elements align to the left. Remove the margin: -25px of the logo. Resete margins and spacing of the ul. Place display: inline-block in li’s and with text-align:…
-
1
votes1
answer92
viewsA: Reduce UL padding during scroll
Only with CSS you can’t because you can’t listen to the scroll event with CSS. The media query you are using does not calculate scroll position, it just checks whether the window height is greater…
-
1
votes3
answers515
viewsA: Button type reset calls a function
Places an attribute onclick calling the function and passing any value: <button type="reset" onclick="mostrarConteudo(this)">Resetar Form</button> If the value of the parameter passed…
-
2
votes1
answer98
views -
5
votes2
answers73
viewsA: What makes a code have different visual representations in different browsers?
Bootstrap 4 is HTML5-based and the marquee is obsolete. Although it even works, it is not recommended to use it as it can be removed at any time from browsers. With this, Firefox along with the BS4…
-
1
votes1
answer669
viewsA: How to place two Carousel, one next to the other with bootstrap
Place the two Carousel inside a div.row, which is flexbox in Bootstrap 4, which both will stand side by side: <script…
-
0
votes1
answer300
viewsA: How to apply Date/Time format in a Datatable column?
Can convert to format dd/mm/aaa hh:mm:ss using .toLocaleString() within a function render in target 4. Just change the line: { className: "align-left", "targets": [4] }, For: { className:…
-
1
votes1
answer52
viewsA: Images duplicating at the time of transfer with Ajax jQuery!
Don’t put the Event Handler .submit within the function and do not use onclick in the form to call a function. When you click any part of the form area it will call the function and create a new one…
-
2
votes3
answers95
viewsA: How can I copy content from a div to a hiddenfield?
It seems to me you’re trying to catch one value of a div: <div id="list"></div> <-- a "div" var valor = $('#list').val(); <-- pegando o "valor" Div does not have "value". If you…
-
-1
votes2
answers134
viewsA: Why is readonly valid on the form?
Not valid, it simply does not pass the checkValidity API. The API ignores input fields with the attribute readonly, that is, the attribute required will have no effect. See here a list of elements…
-
1
votes1
answer73
viewsA: Problem with exporting xls
You have 2 problems with your code: document.getElementById('conteudo').innerText The .innerText will send the content in plain text to the element, that is, the HTML tags will be printed in text…