Posts by Jader A. Wagner • 4,921 points
176 posts
-
1
votes2
answers78
viewsA: Send information about the link clicked to the server before redirecting
You can modify href at click time and intercept the URL in a PHP file: $(document).on("click", "a#clique", function(){ $(this).attr('href', 'click_register.php?url=' +…
-
2
votes2
answers246
viewsA: Add index value of the same name to the PHP array
Simplifying the code of Augusto Vasques, and returning the result in the same input format: <?php $vendas = array( [ "Produto" => "chocolate", "Quantidade" => 300 ], [ "Produto" =>…
phpanswered Jader A. Wagner 4,921 -
1
votes1
answer118
viewsA: jQuery Function crashes after Ajax search
You need to add the events into a parent element, which is not changed by ajax after the initial upload, something like: $("body").on("click", 'a[href^="#"]', function(event){…
-
0
votes1
answer626
viewsA: Datatable Server Side does no paging, sorting, or searching
You need to use in your main query the parts of SQL that the script mounts and that will effectively do their proper functions, something like: $sQuery = " SELECT SQL_CALC_FOUND_ROWS " . str_replace…
phpanswered Jader A. Wagner 4,921 -
1
votes4
answers790
viewsA: capture value of < option > with jQuery
Also to do with pure javascript: <select name='busca' onChange='location.href="envia.php?op="+this.value'> <option value="1">OP1</option> <option value="2">OP2</option>…
-
6
votes2
answers339
viewsA: How to avoid very big win condition in old woman’s game?
I found the method below in that Old game tutorial and adapted in its function, as I have not tested, it is possible that it is necessary to convert the calculation to string to work properly.…
-
1
votes1
answer70
viewsA: Registration with Jquery with error
You have a small logic error in IF checking the reply, try with the following modification: $(function($) { $('#formcad').submit(function() { // Limpando mensagem de erro $("#resposta").html(''); //…
-
0
votes3
answers30
viewsA: Show different contents when selecting one of the buttons
One of the wonders of CSS or jquery selectors, is that they can be grouped together, and this serves to avoid code repetition unnecessarily. Particularly I prefer to always work with classes, but…
-
1
votes2
answers1289
viewsA: View Div with specific content by clicking link
My approach uses a hidden element within the link itself, which when clicked copies its html content to the presentation div. I believe that this way it is easier to edit the contents, especially if…
-
1
votes2
answers41
viewsA: Function does not run 2x
When I have this kind of situation, I prefer to use a date attribute to define the target element, as in the example below: $('[data-target]').click(function(event) { event.preventDefault();…
-
0
votes2
answers60
viewsA: Save form attribute without name defined
You can create an array in the name attribute like this: <input type="submit" class="btn-cad" style="color: white" value="Apagar" name="ref[<?= $linha['id'] ?>]"> and in PHP get the ID…
-
2
votes1
answer985
viewsA: Dynamic forms on the same page in Jquery and PHP
When you need to work with multiple similar elements that use the same function, always prefer to use class instead of ID, in your case it would be something like this: (also analyze the…
-
0
votes1
answer213
viewsA: Javascript function does not work completely with jQuery
I found in the dataTables manual version 1.10.12, an example of filters with select input, I was able to adapt in your table, see if this helps you in any way: $(document).ready(function() {…
-
20
votes4
answers6695
viewsA: Is it possible to make a tooltip with pure CSS?
My idea is to use the data-tooltip attribute itself as a selector, and allow use in any type of tag: [data-tooltip] { position: relative; cursor: pointer; } [data-tooltip]:before { content:…
-
0
votes2
answers48
viewsA: Reduce this jquery to only 1 block and not 3, how do I do?
The wonder of Jquery is to allow you to select almost everything you want without having to modify the html code, below are some examples: $('h1 .icon-info').hover(function() { $(this) // representa…
-
3
votes3
answers389
viewsA: Conflict between jquery and min-jquery
The version . min is not a version with reduced features, but rather compressed, that is, it is lighter to load, but has all the features of the uncompressed version, in general you use the full…
jqueryanswered Jader A. Wagner 4,921 -
1
votes2
answers328
viewsA: With "echo" it works and with "Return" it doesn’t
Following the reasoning of my previous answer: As you are calling the function within the function itself, you need to do something with the result of this second call, ie return to where you first…
-
0
votes4
answers6145
viewsA: Character limit in a DIV
If you have a language in serverside, as for example. php, it is better to make the substring before sending the full content pro browser, but if this is not an option, or if you want to allow the…
-
0
votes1
answer1184
viewsA: how to remove an append
EDIT: As this adding several elements they may not have the same ID, use the class to identify them, and to remove do the search in the same Parent that was previously added...…
-
0
votes3
answers536
viewsA: Retrieve from the database the "data-*value" attribute of a field through jquery
I think enable the button with "on change" would be enough, but below follows a more elaborate form, in which if you return the initial value of the field, the button is disabled. $('form…
-
5
votes2
answers149
viewsA: PHP - How to make a GET pull a include?
Yes it is possible, in my projects I use so: $page = $_GET['page']; if (file_exists($page.".php")) { include($page.".php"); } else if (file_exists($path_paginas . "/".$page.".html")) { echo…
phpanswered Jader A. Wagner 4,921 -
6
votes4
answers17399
viewsA: Average between 3 notes
Refining the Maniero code: var ordinais = ['primeira', 'segunda', 'terceira']; var media=0; for (var i = 0; i < ordinais.length; i++) { var nota = prompt("Informe a " + ordinais[i] + " nota: ");…
-
0
votes1
answer46
viewsA: As Create a select menu, it is in the first position with the current url
You can do with jquery like this: // adicionar a nova option e em seguida seleciona-la $('select').prepend($('<option>', { value: window.location.href, text: document.title…
-
2
votes1
answer57
viewsA: "n" be transformed into "<br>" automatically
nl2br (PHP 4, PHP 5, PHP 7) nl2br - Inserts HTML line breaks before all newlines in a string Description string nl2br ( string $string ) Returns string with <br /> inserted before all…
-
2
votes2
answers328
viewsA: With "echo" it works and with "Return" it doesn’t
Every function should do or return something, it seems obvious, but that’s exactly where you’re getting confused. When you call the function so: <?php…
-
0
votes3
answers276
viewsA: I cannot close div using IDE jquery
I increased the response of Sampaio with some more features, just adjust for the effect you think best (fade, slide or show/Hide) $('.showSingle').click(function() { var $target = $('#div' +…
-
1
votes3
answers2458
viewsA: How to delete Input Placeholder when Clicking inside the Field
You can also do it with CSS: input:focus::-webkit-input-placeholder { color: transparent; } input:focus:-moz-placeholder { /* Firefox 18- */ color: transparent; } input:focus::-moz-placeholder { /*…
-
0
votes4
answers424
viewsA: Request with ajax
Below is an idea of how to do automatic batch sending, just implement the "paging" in the email trigger... var enviados = 0, timer; var emails = 10; // emails por lote var minutos = 5; // tempo de…
-
0
votes1
answer91
viewsA: PHP_ Display HTML SELECT information on the page itself
Below are two options for how to do with jquery. $('select').change(function() { // opção 1 if ($(this).val()) $('div.op1').append($(this).val() + '<br>'); // opção 2 if ($(this).val())…
phpanswered Jader A. Wagner 4,921 -
0
votes3
answers43
viewsA: how to execute a specific button on a list of 5 identical buttons
The ID attribute as well as classes should not be started by numbers, and since you apparently need the ID number to select the record in the BD, I recommend using the attribute data-id thus:…
-
2
votes1
answer1047
viewsA: Disable Input if Specified Radio Button Is Selected
You need to check which option is marked on the radio and only apply appropriate validation. There are some elements with the same id (id="campo-obrigatorio") the ID parameter should always be…
-
0
votes3
answers222
viewsA: Displaying disabled checkbox value
Here’s another example for you to analyze: $('.numeros .btn input').click(function(e) { if ($('.numeros .btn input:checked').length > 10) { alert('Voce selecionou 10 numeros'); return false; }…
-
2
votes5
answers7505
viewsA: How to make the font size automatically fit the size of a div
You can also do this by adjusting the scaleY of the contents inside the container: $(function() { $('.container').each(function() { var scaleY = $(this).height() / $('.conteudo', this).height(),…
-
2
votes4
answers4799
viewsA: How to turn a rectangular image into a circle (without distorting it)
The way I found was to center the image inside a rectangular div, place it inside a square div, pull half the leftover left, and finally hide the overflow and round the father div of all: .posts…
-
3
votes2
answers9302
viewsA: how to make a div float on another div
I think that’s about what you want... (I copied some details from the web.) .f { position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; padding: 0; margin: 0;…
-
0
votes1
answer441
viewsA: Modify a href URL using PHP HTML DOM
I think you can do it using the str_ireplace in the $value before giving echo: $site = "http://exame.abril.com.br/"; $exame = file_get_html($site); $exame_posts =…
-
1
votes1
answer104
viewsA: How to create a loop between the records and the current php date
I would advise changing the variables to array, it is much easier to work with loops, but if there is no way to change it now, below is a way to do: <div id="vendas_diarias" style="height:…
-
0
votes3
answers357
viewsA: Fix Div with Javascript
The only way to "fix" javascript is by listening to the page scroll and updating the position of the element in real time, but this will always generate a strange blink in the element, to be really…
javascriptanswered Jader A. Wagner 4,921 -
0
votes3
answers526
viewsA: Onblur event cancels the onclick event in jQuery or pure Javascript
I was intrigued by the "conflict" of events, and testing some details I came to the conclusion that it is not conflict. It turns out that in windows if you click a button, drag the mouse out and…
-
0
votes1
answer131
viewsA: Problems creating a reusable modal
The problem is occurring because you are never updating the original html, so you are always getting the same value... Below is the corrected code and working, see explanations in the code comments:…
-
2
votes1
answer1054
viewsA: How to know which div is shown on the screen with javascript?
As I am working a lot with scroll in the last few days, was at my fingertips, follows below a simple example, just implement control variables to check if the action has already been fired and avoid…
-
1
votes1
answer332
viewsA: Problems with utf8_decode in array return
The json_encode function only accepts values in utf8, if it has a single character in another encoding it will return null. Apply utf8_encode to all array elements before passing it to json_encode.…
-
0
votes2
answers2237
viewsA: PHP insert a data array into a mysql table
At oscommerce has a function that does just what you need and even has some cool features, just adapt in your project or analyze the code and do something similar: // função principal function…
-
1
votes1
answer47
viewsA: Menu 2 effects: one for scrolling down and one for opposite
Save the current scrollTop in a variable and in the next scroll check whether it was larger or smaller: var scrollbkp = $(window).scrollTop(); // inicia a variável global com o scrollTop atual…
-
1
votes1
answer40
viewsA: Problem capturing element position when there is a scroll in jQuery
In addition to the current position, you need to add the Parent scrollLeft in case the parent UL. howFar = $(this).position().left + $(this).parent().scrollLeft(); If the problem is occurring with…
jqueryanswered Jader A. Wagner 4,921 -
5
votes1
answer145
viewsA: Initial condition (IF) does not work
The logical operator for different is: != And the return of property style.backgroundColor is in rgb(x,x,x) and not in hexacolor, so try the following syntax: if(casa.style.backgroundColor !=…
-
3
votes2
answers492
viewsA: jQuery, native window.width() and window.on resize in the same condition
Create a function and run the function in both cases... function blah() { // BLAH BLAH BLAH } if($(window).width() > 800) { blah(); } $(window).resize(function(){ if($(window).width() > 800) {…
-
3
votes2
answers675
viewsA: How to cancel event click on site
If .wrapp is an overlay on the clickable objects, replace: $(this).click(false); for: event.stopPropagation(); $('.wrapp').on('click', function(event){ if ( ($('#sidr').is(':visible')) ) {…
-
1
votes2
answers248
viewsA: To do a complex search I would have to use OR to combine all the instructions?
You must use and and or separated into blocks with parentheses, for example: (tipo = apartamento or tipo = casa) and (dormitórios = 2 or dormitórios = 3) and (vagas = 1 or vagas = 2) and (area >…
-
3
votes3
answers1346
viewsA: Generating an image based on other images
I didn’t quite understand the real need to generate an image, my suggestion is to build the frame with CSS superimposing the images, something like that: HTML: <div class="campo"…