Posts by Sam • 79,597 points
3,121 posts
-
0
votes1
answer241
viewsA: Button mobile device responsive
Change your class text-right for text-center and add another class text-sm-right. This will cause the element to align the text (including the button) to the center when the resolution (width) is…
-
1
votes1
answer127
viewsA: Jquery event . change running when loading the page?
In doing so, as stated in the question: $("#tipoProcedimento").change(carregarProcedimentos('#procedimento','#tipoProcedimento')); You are running the function carregarProcedimentos as soon as the…
-
1
votes2
answers6721
viewsA: Place elements side by side using HTML and CSS
I don’t think you need those records id="1" and id="2". You can make it simpler in this structure: <header> <figure>LOGO</figure> <nav>MENU</nav> </header> Use…
-
1
votes1
answer26
viewsA: Load image url - Jquery
You can do it like this: $(function(){ $("#miniatura_exibe").attr("src", $(".miniatura").val()); }); The $(function(){ is the same as $(document).ready(function(){, that is, when the DOM is loaded.…
-
0
votes1
answer148
viewsQ: Why does this "for" with double condition give infinite loop?
According to this documentation of the loop for in Javascript, the second expression is a condition: for ([inicialização]; [condição]; [expressão final]) declaração If I make a condition like this:…
-
2
votes1
answer66
viewsA: Javascript - How to create two-dimensional arrays and loop them?
You can create an array of objects, where each object stores the student’s name + the 4 notes, in this format (the values are hypothetical): notas = [ {nome: "aluno1", nota1: 2, nota2: 4, nota3: 5,…
javascriptanswered Sam 79,597 -
3
votes1
answer57
viewsA: How to identify the exact element that contains a specific word
The .children only returns direct children (not grandchildren, great-grandchildren, etc.). Your code is searching within the only direct child of #container if there is the searched text. Both the…
-
2
votes1
answer90
viewsA: How to view form information obtained in PHP in a Boostrap modal?
The button that opens the modal is the same as the Ubmit of the form. With this when you click on Calculate without filling any of the fields will open the empty modal, as the two fields have the…
-
2
votes2
answers67
viewsA: Limit number on an input
This feature of typing the 4 appear the 2 can be dispensable as the user may intend to type 41 and this will mess instead of helping. But you can change the value of the field to the minimum if a…
-
2
votes1
answer19
viewsA: Delete an entire class and everything in it from an HTML loaded via ajax
Use the method .load() where you can search in the requested file for a specific element: $("#viewdata").load("noticia.html .conteudo"); The above code will replace all internal div HTML #viewdate…
-
3
votes1
answer168
viewsA: check not allowed characters within the input and alert user
To check the invalid characters you can use the .test() with the regular expression below: /[oiq]/i.test(written) The whole [oiq] checks if the string contains the letters o, i or q, and the flag i…
-
1
votes1
answer70
viewsA: navbar overwrites the other elements when the page size is changed
Remove from body whichever padding-top and insert the code below on the page (at the end of the body): $(window).on("load resize", function(){ let navHeader = 0;…
-
2
votes1
answer68
viewsA: Why isn’t my animation working?
CSS animations do not work with display. If you want the paragraph to be hidden after 1 second, you could even use a combination of visibility: hidden with Javascript, where Javascript would detect…
-
0
votes3
answers45
views -
3
votes2
answers96
viewsA: Remove elements created within a function
Your forEach is removing all. You can do so to remove the last: botao_remover_vip.onclick = function() { const itens = document.querySelectorAll('.teste1'); if(itens.length){…
javascriptanswered Sam 79,597 -
2
votes1
answer510
viewsA: Why is the Submit input not the same size as other inputs?
This happens because the button (both button with input how much button with button) is by default property box-sizing worthwhile border-box: The value border-box prevents the padding and the edge…
-
2
votes2
answers46
viewsA: My page does not fully populate the mobile window. Why?
As Thiago’s reply quoted, by specifying a width fixed in the div of 994px, if the screen is smaller than this, the div will continue with the same 994px width, creating this empty space on the right…
-
2
votes1
answer48
viewsA: Doubt with login validation
Put the session_start(); only once at the beginning of the block: <?php session_start(); // resto do código Do not use the operator && in Mysql, and yes the AND (see documentation).…
-
2
votes3
answers123
viewsA: Compare range of values
Maniero’s response is very practical, but for maintenance it is confusing because if you want to change the percentage of a track is confused to know which item of the array to change. For example,…
-
0
votes1
answer191
viewsA: Align span tag with html to add edge
You don’t have to use margin-bottom: 1px. CSS has all properties suitable for element alignment. Using margin to fix height, in my view, is to make up the problem. Put the class .d-flex in the div…
-
5
votes2
answers85
viewsA: "this" within object properties
In one method, the this references the owner object of the method. In a "normal" function references the global object (I say "normal" because it is not a method or event function). In his example,…
-
0
votes1
answer46
views -
2
votes1
answer186
viewsA: Enable input when arriving at selected checkbox amount
You are repeating the id="seleciona", and with this Javascript will always find the first one it finds. So change only works in the first checkbox. An id must be unique on the page, it cannot be…
-
2
votes1
answer58
viewsA: Identify the selected INPUT array key
I think you are wrong. Your code does not return the index of the input within the brackets, it returns the value of the attribute as it is in the HTML. Behold: <script…
-
3
votes2
answers164
viewsA: How do I add 3 side-by-side images and captions on top and bottom in css
It makes no sense to use different classes in each div’s daughter .produto. Because the way you’re doing, all 3 classes you’ve created have the same properties with equal values. Classes should not…
-
0
votes2
answers63
viewsA: how Function would look to enable several checkboxes from a Radio type
Put values on each radio button. It will be useful if you submit to the server and useful to use in the script to differentiate one element from the other (no need to use id that is unnecessary for…
-
3
votes2
answers73
viewsA: How to remove events that are created using Arrow Functions?
Just you name the Arrow Function and use .removeEventListener where the second argument is the name given to the function Instead of an anonymous function (ev)=>, put a name, like clique =…
-
1
votes1
answer140
viewsA: Javascript overwriting class css
For appearance and class .selectboxit you are using a plugin called Selectboxit, and it has its own method to select by adding new options. If you add options directly in select without calling the…
-
3
votes1
answer77
viewsA: HTML/CSS: When I click on the link it does not go to the right point of the page
Anyway you need to put one padding-top in the body of the same height as nav, but the first section will overlap. body{ margin: 0; padding-top: 60px; } See that I reset also the margin to eliminate…
-
4
votes1
answer261
viewsA: Add click event on all buttons with pure Javascript, which is equivalent to jQuery
Create a onclick in the body that will click on any element of body whole. Then you check if the clicked element has the class .btnExcluir: document.body.onclick = function(e){…
-
1
votes1
answer146
viewsA: Click and make options disappear with CSS
If you want to hide the menu after clicking on the link, with CSS you won’t be able to. You have to hide the menu inside the event that captures the click on the menu links: $(".dropdown-menu li…
-
1
votes3
answers184
viewsA: How to pass a personized function within a Jquery Change event?
You can do this by passing the event to an anonymous function along with parameters: $(document).ready(function() { $("select").change("param", teste); function teste(event) { console.log("Valor…
-
0
votes1
answer37
viewsA: Problem with length!
Include in if a condition verifying whether value is not null: if (value && value.length < 5) { ↑ See working: function MyViewModel() { self = this; var registro; self.Nome =…
knockoutjsanswered Sam 79,597 -
1
votes1
answer53
viewsA: Only the first select works (Popular selects with Parent element php javascript)
You cannot repeat id’s on the same page as you will only get the first one you find. Use class instead of id. Just change id="select1" and id="select2" for class="form-control selectboxit select1"…
-
0
votes1
answer31
viewsA: Pass Array value by checkbox
This is because you are sending the form without checking any checkbox, and with that the array $_POST["seleciona"] does not exist. When a checkbox is not checked, it is not sent in the POST. The if…
-
1
votes1
answer141
viewsA: How to hide my label after input selection?
The way you want to do it doesn’t seem feasible because when the input loses the focus, to label will again appear on top of what was typed in the input. You would have to do an additional control…
-
1
votes1
answer25
viewsA: Text is not up next to images
Place the property vertical-align: top in the third <li> of the list: *{ margin: 0; padding: 0; } .logos-container{ background: #ccc; } .logomin{ width: 245px; } .logoaetr{ width: 145px; } ul{…
-
2
votes3
answers122
viewsA: How to obtain the contents of an HTML element from a Regex string?
Use DOMParser in this way: var content = '4354543/sfd f^^ <textarea id="text">Hello World! 34% #_2@.;/°? </textarea> fr fdgdf //fdg3'; var result = new…
-
1
votes2
answers57
viewsA: If condition breaks before changing the value of the variable
From what I understand, you should put the if which will enable or disable the button after the for, why are you using break to stop it. So when the condition inside the for is met, the loop will…
-
1
votes1
answer142
viewsA: Load Code in JS
After the event.preventDefault() place: var carregando = document.getElementById("carregando"); if(carregando && carregando.length) carregando.outerHTML = ''; var lista =…
-
2
votes1
answer173
viewsA: How do I find out if the form was loaded into a variable or not?
You can iterate the FormData and check if any field of the form has value. Just iterate the property .entries() which returns for each field an array with a pair of values, the first being the name…
-
2
votes2
answers128
viewsA: Can someone help me with that effect?
Another very simple way to do this effect, using pseudo-elements and border-radius. I changed the position of .menuCurva to fit inside the div .icons where he is. Error: body width is wrong. It…
-
2
votes1
answer71
viewsA: Is there any way to break every word of a span text into children?
One way to do this is by breaking the text of spans by space then using regular expression (in case there are tags <>) and make substitutions by adding each word inside a span:…
-
1
votes1
answer72
viewsA: How to show a div and hide others with Javascript?
There are several ways to improve code at CSS and HTML level (for example, use class instead of id), but you can improve Javascript code by simplifying the function: function esquemaLupa(num) {…
javascriptanswered Sam 79,597 -
0
votes1
answer50
viewsA: Why does the dropEffect property not work?
When you drag an element, the cursor changes according to the area where it will be dropped. For example, when the element passes over a non-dropable area, the cursor shows an icon that looks like…
javascriptanswered Sam 79,597 -
1
votes4
answers62
viewsA: The display property exchange does not work with if em js
By default, an image is not an element of block (block), is an element of line (inline), so don’t use .style.display = "block"; instead use .style.display = "inline" to display the image. To switch…
-
2
votes1
answer75
viewsA: Why doesn’t my Div, raised in JS, show up?
The problem is that you are putting the values of width and height wrongly. The Divs are even being created, but they do not appear because they have nothing in them and the values of the properties…
-
3
votes3
answers165
viewsA: Difficulties in running Whatsapp button source code in HTML
According to the documentation, your link is incorrect. Instead of: https://wa.me/55(77912345678)? text=Enter%20in%20contact Seria: https://wa.me/5577912345678?text=Entrar%20em%20contato The numbers…
-
0
votes1
answer28
viewsA: Why are you returning this error to me on the console?
You are trying to insert a knot inside yourself. You solve this by checking with a if if the dragged element is different from the element where it will be dropped: if(event.target !=…
javascriptanswered Sam 79,597 -
3
votes2
answers189
viewsA: Content of one div exceeding the other div
Use flexbox with column direction in div #div (which is the div where the div is #divconteudoemail) and add flex: 1 in the div #divconteudoemail in addition to other properties to adjust spacing.…