Posts by Sam • 79,597 points
3,121 posts
-
0
votes1
answer1430
viewsA: Navbar Toggle button does not appear
You need to open the tag <nav> with the classes required by Bootstrap: <nav class="navbar navbar-light"> <a class="navbar-brand logo" href="#"> <img src="img/init1.svg"…
-
2
votes1
answer479
viewsA: How to preview the selected file title via Javascript?
Since you won’t be using images to see one preview of them, you can dispense with the API FileReader() and use the code below to take the file name and display an icon (if it is word or pdf):…
-
0
votes2
answers308
viewsA: How to duplicate select without previous option
Two ways: Keeping the option to insert: $(document).ready(function(e) { $('#addComp').on('click', function(){ var valor_excluir = $('.composicao').last().val(); //pego o value selecionado…
-
0
votes1
answer55
viewsA: Remove underlined name and tag <b></b>
Access the "tooltip.php" file and change the CSS line: .lege {color:#ff8f00;font-weight:bold;font-size:12pt;text-decoration:underline;padding-bottom:6px;} To (removing the…
-
1
votes1
answer72
viewsA: Trouble with Nan
Replace the code of this block: // Imprime os preços internos // Aqui é para limpar os excessos do setInterval var counter = 0 var timer = setInterval(function(){…
-
3
votes3
answers664
viewsA: Required no Ajax
You can add a dynamic alert message above the buttons when you give the error specified in your question. If you want another type of alert, you can format the element. First create an event to…
-
1
votes1
answer193
viewsA: What is the difference between setAttribute() and setAttributeNode()?
Both have the same function: create (or change) an attribute in the element and set a value. Only changes the form of construction (if the attribute already exists, it will be ALL replaced by the…
javascriptanswered Sam 79,597 -
1
votes3
answers2363
viewsA: Change height with javascript
Your mistake is only on this line: if(altura.style.height <= "580px"){ Instead of comparing if it is equal to or equal to, compare if it is equal: if(altura.style.height == "580px"){ var altura =…
-
1
votes1
answer87
viewsA: Search phrase in database
If you are Mysql, you can use LOCATE or LIKE: "Select * from tabela where LOCATE('". $_GET["frase"] ."', campo) > 0" "Select * from tabela where campo LIKE '%". $_GET["frase"] ."%'"…
-
8
votes3
answers3452
viewsA: What is an absolute value?
In mathematics, absolute value is the distance at which a number is from 0: R = {...-3,-2,-1,0,+1,+2,+3...} |_______|________| 3 The -3 is "3 houses" from scratch, as well as the +3. Therefore, the…
-
0
votes3
answers1333
viewsA: HTML link to open form without causing refresh on page
Change the href for javascript:void(0): <a href="javascript:void(0)" onclick="window.open('form.html', 'Pagina', 'STATUS=NO, TOOLBAR=NO, LOCATION=YES, DIRECTORIES=NO, RESISABLE=YES,…
-
1
votes1
answer26
viewsA: Doubt on the banner
The operator % is not division. It returns the "rest" of the division of the first number by the second, when the first is equal to or greater than the second. If the first is smaller, it returns…
javascriptanswered Sam 79,597 -
1
votes2
answers403
viewsA: Problems with javascript and google maps API
If you included the attributes async defer on the tag <script>, the ideal would be to pull the variable distance from a function. That’s because if you put the variable distance in the alert,…
-
2
votes2
answers993
viewsA: Limit image size
You can set a height-maximum (max-height) to the images in the class .novidade-texto img: .novidade-texto img { max-width: 100%; margin: 30px auto; display: block; max-height: 100px; /*Por exemplo,…
-
2
votes1
answer142
viewsA: Limit number in input box
Boot maxlength="9" in the input you want to do this. With this, the field will not receive more than 5 characters typed (already with the decimal point and the symbol "R$ "). Example: R$ 200.00…
javascriptanswered Sam 79,597 -
2
votes2
answers905
viewsA: Insert ID from one Table into another Table
You can do a SELECT and INSERT in the same query: INSERT INTO tabela2 SELECT null, Id_titulo FROM tabela1 WHERE Id = '9999' The above code will make an INSERT in the "table2" taking the field…
-
1
votes3
answers38
viewsA: Select in each response different values with Mysql Database
Functional code: select count(case when `Unidade I` > 6 then 0 end) as 'Unidade I', count(case when `Unidade II` > 6 then 0 end) as 'Unidade II', count(case when `Unidade III` > 6 then 0…
-
2
votes2
answers566
viewsA: Convert Number to Real
I suggest a jQuery plugin called maskMoney (download here). It adds coin mask in the field you specify. To use it, click on your page with: <script src="jquery.maskMoney.js"…
javascriptanswered Sam 79,597 -
1
votes2
answers4846
viewsA: How to take 2 decimal places
With toFixed(n) you convert a number into a string with n decimal places. var numero = 0.2333333; numero.toFixed(2); // 2 casas decimais Upshot: 0.23 JS works with decimal places separated by ".".…
-
1
votes2
answers420
viewsA: Uncaught Typeerror: Cannot read Property 'split' of Undefined at Xmlhttprequest.alertContents
Your code has problems receiving the XMLHttpRequest. Are you checking the readyState before loading the return. The correct would be: function makeRequest() { httpRequest.open('GET', 'result.php');…
-
1
votes2
answers142
viewsA: Css does not change color to transparent
You can put the CSS inline direct in the element with style. This ignores all references of the style background element from some CSS: <div class="navigation" style="background:rgba(243, 241,…
-
0
votes3
answers131
viewsA: Html, icon respecting page background color
There is a way to make a specific color of an image transparent using canvas. In your case, the image has a white background, so with canvas, not only would the background be transparent, but any…
-
3
votes2
answers171
viewsA: Open images in the background
You can use the plugin Lazyload to load the images only when they are in the visible area of the browser screen. The advantage of this is that there is a performance gain in page loading and also…
-
2
votes1
answer119
viewsA: Printar php results in Divs
First, the operator = is incorrect on the line: if ( $valor = "Sair" ) { The right thing would be to use == (PHP comparison operators): if ( $valor == "Sair" ) { Updating the response: In your code…
-
5
votes2
answers6727
viewsA: Day of the week by php variable
$meses = array (1 => "Janeiro", 2 => "Fevereiro", 3 => "Março", 4 => "Abril", 5 => "Maio", 6 => "Junho", 7 => "Julho", 8 => "Agosto", 9 => "Setembro", 10 => "Outubro",…
-
4
votes4
answers380
viewsA: column-Count in css by breaking the line at the beginning of the column
The only way I found to adjust this is by using jQuery. I eliminated all the <br> and included each line of text within a paragraph <p> with upper margin 0. For this I added the css:…
-
0
votes1
answer264
viewsA: Jquery Fancybox: Pass a parameter to an inline window
You can add an attribute data-tipopag at each link <a> that will open the modal and capture later: <a data-tipopag="Dinheiro" class="btn btn-success fancybox" href="#divFormaPgto"…
-
2
votes3
answers141
viewsA: Which HTML attribute cannot be modified?
There’s no stopping it. If the client changes a code that will be sent to the server, it is the server that should validate: check if the value exists, if the value received is valid, if the client…
-
1
votes2
answers288
viewsA: Changing button function via jQuery
I understood your purpose in the other question (including putting the full answer there). First, assign a id different for each button (the id must be unique in the document). You can do so:…
-
2
votes3
answers230
viewsA: Changing button span through jQuery
A more elegant and short way to do this: success: function(retorno) { i = $j("#cartaoMensagem"+product_id); i.text() == "Comprar" ? ( i.html(i.html().replace("Comprar","Remover")), $j("#cartao…
-
0
votes1
answer33
viewsA: Execution of setTimeout with replaceWith
There’s a problem with your code: You put a setTimeout within the "Success", "error" and "complete" blocks, so when Ajax returns ok, it will call the 2 setTimeouts and will cause a bottleneck in…
-
4
votes1
answer55
viewsA: Streamline language to placeholder
Yes. The placeholder is an element attribute. So you can change it: function teste() { $("#teste").attr("placeholder","Enter your username"); } <script…
-
1
votes1
answer97
viewsA: Insert colored border into image that is cover
Apply a css inline in the div you want the colored border: <div <?php if($capa == 1){ ?>style="border-color: #f30;"<?php } ?>></div>
-
0
votes1
answer70
viewsA: grid display using different grid-Row-gap for each line
I don’t see the possibility of changing the grid individually within a collection of Divs within a div-mother. The solution I suggest is to force the first div to go 10px down and climb the 10px…
-
-1
votes2
answers956
viewsA: Push a button through the keyboard
Works also on Mac: document.addEventListener("keydown", function(e){ if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){ e.preventDefault(); alert("CTRL+S…
-
1
votes3
answers791
viewsA: Change the Background-color of a div within a link
Change the alpha of background from 0.53 to 1: background-color:rgba(36, 161, 238, 1);
-
2
votes2
answers52
views -
0
votes2
answers386
viewsA: Pass jquery value to php
Not. You cannot change the page via PHP after it has been sent by the server. This is possible on the client side (e.g. JS, jQuery). Updating: What you can do is load the page…
-
0
votes2
answers49
viewsA: Do you have a problem creating an element and setting the id to empty?
No problem, in case you don’t need to reference the element ID in your project. Regarding the reply of the friend @Genos, although he cited the source of W3, the ID and NAME not necessarily need to…
-
0
votes2
answers1357
viewsA: Java Script does not change a div with display from "None" to "block"
Are you changing the display only from 1 div which contains another which is also hidden. The solution is to remove the style="display:none;" of the internal div divInstituicaoEstrangeira change…
-
0
votes2
answers124
viewsA: Go to anchor before full page loading
The code below should work for your purpose: <script> curr_url = window.location.href; //pego a URL da página if(curr_url.indexOf("#") != -1){ // verifico se existe # na URL parametro =…
-
1
votes1
answer100
views -
2
votes1
answer737
viewsA: Displaying 'load' warning when iframe update - html
You need to make a communication structure between the frame and the main window, checking when a navigation link inside the frame is clicked and when the frame is loaded. To do this, you need to…
-
1
votes3
answers62
views -
1
votes1
answer1930
viewsA: Move down button and center - Bootstrap 4
Testing in the mentioned example of the Bootstrap site, add the Styles: In the <a> of LOGO: style="display: block; width: 100%; text-align: center; margin: 0;" In the <button>:…
-
0
votes3
answers625
viewsA: Set shadow in email HTML table
Many email clients (e.g. Gmail) ignore bolder CSS codes, as well as ignore importing external CSS code (.css) or inserted into one <head>. Use the CSS inline in the elements with style. Ex:…
-
0
votes2
answers110
viewsA: Delete multiple Rows using php and mysql checkbox
Has 2 <form> on the page. It is sent the second that has nothing on it. Erase the second <form>. Updating: The structure would be this: <form class="customform" method="POST"…
-
1
votes2
answers348
viewsA: check user type for php access
Create a $_SESSION['tipo'] = $linha['tipo']; also in the login and in the panel pages, <header>, for example, you check the type: <?php if($_SESSION['tipo'] != 2){ // redireciona pra fora…
-
4
votes1
answer12636
views -
2
votes3
answers154
viewsA: Javascript remove() does not work
A suggestion also to make your code cleaner: And instead of you concatenating the lines repeating the variable container, just put a + at the beginning of each line, and only place ; at the end of…