Posts by abfurlan • 10,570 points
221 posts
-
4
votes4
answers63
viewsA: Positioning of li’s on the page
You can use the property display: table, example: ul.menu{ width:100%; padding:0; display: table; } ul.menu li { background-color:gray; display: table-cell; } ul.menu li a{ display:block;…
-
2
votes5
answers267
viewsA: Store arithmetic operator in variable
Another way to implement is by using BC Math Functions and call_user_func, example: /* * bcadd = adição * bcsub = subtração * bcmul = multiplicação * bcdiv = divisão */ $operador = 'add'; $val1 =…
-
3
votes1
answer785
viewsA: Mount one HTML table from another’s records with Jquery and C#?
If I understand well you that take selected items in one table and copy to another, for this you can do so: $('#importar').click(function(){ $("#tb2 tbody").html('');//limpa a tabela 2 //percorre…
-
3
votes1
answer3982
viewsA: How to check the modal closure
You can use the event Hide.bs.modal to detect that the modal has been closed. $('#myModal').on('hide.bs.modal', function (event) { //executar algo... alert('modal fechou'); }) <link…
-
4
votes3
answers270
viewsA: Simplifying an Array - PHP
You can use class functions Recursiveiteratoriterator, example: $a = array(array(array("Brasil","Franca","Italia","China"))); $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($a));…
-
0
votes3
answers123
viewsA: check a string with php
One way is to compare the number of commas in the string and the amount of data that these commas separate, for example: $string = "132,234,14,56"; if(substr_count($string,",") ==…
-
1
votes3
answers564
viewsA: Javascript color transition
You can create an animation with CSS to run after x seconds, example: body { -moz-animation: hideMe 0s ease-in 5s forwards; /* Firefox */ -webkit-animation: hideMe 0s ease-in 5s forwards; /* Safari…
javascriptanswered abfurlan 10,570 -
1
votes3
answers290
viewsA: How to change text of <Legend> without knowing the id?
Go through all the elements and change the text as you wish, example: $( "#alterarEnvolvido" ).click(function() { //percorre todos os elementos legend filhos da div #div_1Envolvido…
-
3
votes2
answers525
viewsA: Turn Sequence of Numbers into Data with PHP and SQL
You can also format in Mysql using FROM_UNIXTIME and DATE_FORMAT: Example: SELECT DATE_FORMAT(FROM_UNIXTIME(1464880280),'%d/%m/%Y %H:%i') as dt;…
-
2
votes2
answers175
viewsA: What would be the best way to make a website with responsive design
Developing a responsive interface is not such a simple task, because in a responsive layout it will always be necessary to use elements with relative sizes, hide elements, decrease or increase font…
-
5
votes1
answer2702
viewsA: How to change CSS style of table column when passing mouse?
Using only CSS, you can fake it using the pseudo-element after, take the example: table { overflow: hidden; border-collapse: collapse; border:solid red; border-width : 1px 2px 1px 1px; } table…
-
2
votes2
answers72
viewsA: Show Div if note is less than 8
One way is to put a class for these elements, call a function in the onchange, so you take all the elements and go through checking if any of them are with less than 8 value selected to display the…
javascriptanswered abfurlan 10,570 -
0
votes1
answer124
viewsA: Show the result by clicking the button
You are displaying the value of the button itself clicked when you do AcessarElemento.value, you need to select the field <input type="text" id = "numero"/> by your id, see the example below:…
javascriptanswered abfurlan 10,570 -
0
votes1
answer613
views -
4
votes3
answers4851
viewsA: Cut string at last occurrence of a character in a string
You can use SUBSTRING_INDEX to return occurrences after the delimiter, if the counter is positive returns occurrences from left to end of string, if negative returns from right.…
-
1
votes2
answers412
viewsA: graphic with data from a REST service
Since you did not specify any library, I leave an example using Chartjs: var json = [{"GERENCIA":10,"EMPRESA":"1","FILIAL":"1"}]; json = json[0];//primeiro indice do JSON var labels = [];//array com…
-
1
votes1
answer120
viewsA: compare xml with user responses
I don’t really understand where the correct answers and answers are so you can determine the amount of hits, but I believe this will help you understand how to search the data you want in the file.…
-
2
votes2
answers2528
viewsA: To undo the mouse scroll (zoom) action on a google map Iframe
It is possible to disable mouse events on the iframe, using the property Pointer-Events CSS, but it disables all events. If you want to enable again you can use jQuery or Javascript to enable by…
-
3
votes2
answers167
viewsA: How to add a DIV to each 3 paragraphs (<p>)
You can use a formula (an + b) the selector to specify the elements you want to select. In this formula a represents the cycle size, n is a counter (starting at 0), and b is a deviation value. See…
-
2
votes2
answers93
viewsA: Center form
One way to do what you want is by using the Offsetting Columns, so you can control the size of the fields and the margin to the left of the form, see the example below: <link…
twitter-bootstrapanswered abfurlan 10,570 -
2
votes2
answers73
viewsA: Jquery accumulating events
Utilize .one() instead of .on() when closing the modal, when you use .on() it runs again every click. $('#edit').one('hidden.bs.modal', function(event) { event.preventDefault(); alert(item_id); //…
-
6
votes2
answers670
viewsA: Search within html - no database
If you know which element to search in you can search the text typed by the user comparing it with the texts of these elements within the section, example: $(document).ready(function(){ /* Ao…
-
2
votes6
answers710
viewsA: On Click only works once
By analyzing your HTML code, you can simply do: $('li[name=music]').on('click', function () { $el = $(this).children('div'); /* * Desta forma vc verifica se a div está visível * ao invés de…
-
0
votes3
answers339
viewsA: Bash - Mysql backups
Follow an implementation suggestion, you can adapt and use in your own script: #!/bin/bash #E-mail do adm do servidor EMAIL='[email protected]' #Data Atual DATE=`date +%Y%m%d` #Diretório do…
-
2
votes1
answer1176
viewsA: How to make select using mask on output
You can select parts of the field SUBSTR and concatenate CONCAT with symbols to apply formatting, example: SELECT CONCAT ( SUBSTR('11111111122',1,3),'.', SUBSTR('11111111122',4,3),'.',…
-
0
votes3
answers4070
viewsA: Line Breaking Problems in Bootstrap
One option would be to use a grid .row, and create side by side the components you want. To align the input and the button, you can also use the class .input-group, see in the example: <script…
-
5
votes3
answers13303
viewsA: Star voting with radio input, javascript/css
Following its HTML structure, I leave here a suggestion using jQuery. $('.vote label i.fa').on('click mouseover',function(){ // remove classe ativa de todas as estrelas $('.vote label…
-
5
votes1
answer205
viewsA: Jquery cancel ajax request
You can use the method abort(), example: var xhr = $.ajax({ type: "POST", url: "pagina.php", success: function(msg){ ... } }); //aborta o request xhr.abort();…
-
2
votes1
answer53
viewsA: mytrack.Duration returns Nan
Try to add the event loadeddata, example: mytrack.addEventListener("loadeddata", function() { alert(this.duration); }); The way you are trying to do, the script runs before the audio has loaded, so…
-
4
votes5
answers2967
viewsA: Take all the names and put comma to separate them
Another possible solution to get the position of the last occurrence of the character in the string strrpos and replace substr_replace, example: $arr = array('john', 'Cyrax', 'john', 'Sonia',…
-
2
votes1
answer83
viewsA: Update does not work in database
The problem is in the first if who will always return true if there are data in the table tests and will never enter the elseif to execute update, try to change this elseif by only if and do the…
-
6
votes4
answers114
viewsA: Why is this SQL statement incorrect?
Alternatively the other answers, you can also use the comparison operator IN to check if the desired value is among a set of values, example: SELECT * FROM produtos WHERE categoria = 'Vestido' AND…
-
3
votes4
answers342
viewsA: What is the function of the " | " operator within the catch?
In java SE 7 or higher a single block of catch can handle more than one type of exception, for this you must specify the types of exception you want to capture and separate them by a pipe |,…
-
1
votes2
answers2176
viewsA: How to mouse one element and disappear with another without js
The way you put your div, you can use adjacent selector to hide the widget, example: #sliding_block{ width:100px; height:100px; background-color:red; float:left; cursor:pointer; } #facebook_block{…
-
5
votes4
answers14347
viewsA: How to take a String value before a Special character
You can do it this way: //String a ser analisada String Str = new String("Clinica Antonio S/S"); //Posição do caracter na string int pos = Str.indexOf("/"); //Substring iniciando em 0 até posição do…
-
4
votes2
answers3677
viewsA: How to disable mouse scroll button?
You can prevent the click with the scroll button, example: $('body').mousedown(function(e){ /*button == 0 botão esquerdo do mouse *button == 1 botão do meio, ou botão de scroll *button == 2 botão…
-
1
votes2
answers2044
viewsA: Enable button event by pressing key on keyboard
You can also use the function .Trigger() to trigger a click event on the calculate button by pressing enter: $('input').keypress(function(e) { if (e.keyCode == 13) {…
-
2
votes1
answer116
viewsA: Place checkbox on only two items - JSTREE
You can activate the option to use checkbox in the plugin and hide with CSS those who are not descendants of .jstree-children, example: HTML <div id="jstree"> <ul> <li>Folder 1…
-
4
votes2
answers477
viewsA: How to use PDO bindParam in query IN()?
A suggestion would be to format your query string and then do the bindParam for each parameter, example: $modelos = explode(",","1,2,3,4"); // transforma string em array $query = sprintf("Select…
-
6
votes2
answers422
viewsA: Is it possible to combine first:Child with :Hover?
Yes, it’s possible, you can do li:first-child:hover, example: ul li:first-child:hover{ color:red; cursor:pointer; } <ul> <li>Primeira</li> <li>Segunda</li>…
-
1
votes2
answers195
viewsA: Toggle "a" href by clicking on other elements
A suggestion would be to add a date attribute to the menu button and change the attribute href and the text of the buy button as per the button clicked, see the example:…
-
2
votes3
answers498
viewsA: Write checkbox value to input
A way and go through the checkbox selected when changing any of them, example: $('.dias').on('change',function(){ var dias = []; $('.dias:checked').each(function(){ dias.push($(this).val()); });…
-
17
votes4
answers35105
viewsA: Use of ? and : in PHP
Is a ternary operator, the expression (expr1) ? (expr2) : (expr3) is evaluated to expr2 if expr1 is assessed as TRUE, or expr3 if expr1 is assessed as FALSE. It would be the same as: public function…
-
8
votes2
answers4961
viewsA: Calculate how long it takes to execute a function
To measure the running time you can use performance now.(), example: var teste = []; var inicio = performance.now(); for (var i = 1; i <= 305; i++) { for (var x = 1; x <= 305; x++) { if(x !=…
-
8
votes2
answers125
viewsA: Use of ';' before starting a function
Auto-summoning functions are built between parentheses, placing a semicolon before the start of the function can prevent the function from becoming part of any predecessor code, note that: The code…
-
1
votes3
answers13183
viewsA: HOVER effect on a <li> and the components within it
If you want to change the behavior when there is hover in li, of the child element, which in its case is div classy .icons, you can do: #sair:hover .icons { ... } Take an example: ul{…
-
3
votes1
answer531
viewsA: How to use Ellipsis with Bootstrap menu?
Maybe adjust the width max-width depending on the device, I have come across this problem, and for this case it was enough, see an example: .inline{ white-space:nowrap; overflow:hidden;…
-
7
votes4
answers18313
viewsA: Change point per comma to input value
If you want to change all the elements while loading the page you can do the following: $(document).ready(function(){ $('input[type="text"]').each(function(){ var val =…
-
8
votes1
answer4567
viewsA: Find out if the scroll has reached the end of the DIV
You can do it this way: $(document).ready(function(){ $('div').bind('scroll', function() { /* * scrollTop -> Quanto rolou * innerHeight -> Altura do interior da div * scrollHeight -> Altura…
-
2
votes4
answers22158
viewsA: How to add row spacing to a table?
One option would be to use border-collapse:collapse with lower edge of the tr and color of background and desired space size. Place the background of td of the desired border color and an element…