Posts by Sam • 79,597 points
3,121 posts
-
0
votes1
answer103
viewsA: How to pull data from a login
Create a variable by associating user data to an array and take the NIVEL value: if ($row_count > 0) { $dados = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC); $_SESSION['email'] = $user;…
-
3
votes2
answers132
viewsA: How to block Numberbox or Textbox characters
Instead of using the attribute OnKeyPress, use a Event Handler. Thus, with the function .test() you can cancel the event by restricting the allowed characters with a simple regular expression…
-
1
votes2
answers33
viewsA: Organizing information in table
One way would be to eliminate the td date and place the date after the string "Received:", by placing the th within the while and conditioning the impression of th whenever a different name comes…
-
1
votes2
answers1068
viewsA: Problems with event click on jQuery, AJAX, and PHP
Do not use id’s to grab the buttons. This is bad because you will have to create several different id’s for each button and makes the click event selector more confusing. The ideal is to use a…
-
0
votes2
answers78
views -
3
votes1
answer156
viewsA: Exchanging image with Javascript
Instead of using setInterval() you could use the recursive function, using the callbacks of the .fadeIn() and of .fadeOut(), making a delay of 500 milliseconds on .fadeOut(). Now, the index should…
javascriptanswered Sam 79,597 -
3
votes3
answers541
viewsA: Hide and Show child element via checkbox
You need to hide the td with display: none and show/hide if the checkbox is checked or not checked: $("#variation_1").on("change", function(){ $(this) .closest("td") .next() [this.checked ? "show" :…
-
0
votes1
answer919
views -
2
votes1
answer1061
viewsA: Change <span> text with jQuery+variable
You need to delimit the string in the onclick with single quotes, in this case: onclick="Excluir('@item.nome')" Otherwise it will fail, because it would be a string without delimiter, like:…
-
1
votes2
answers231
viewsA: Stop Preload only when the page loads full
Your code is correct. After loading the object window the event will be triggered load which will execute the method .fadeOut() in the element. Only you are specifying that the fade out will last 2…
javascriptanswered Sam 79,597 -
1
votes2
answers48
viewsA: Disable button after insert
Use an if and remove the ; between the if and the this.disabled: <button class="btn btn-info" onclick="if(confirm('Pretende registar esta atividade?')) this.disabled=true;">Pequeno…
-
1
votes1
answer36
viewsA: Sort 2 arrays with different sizes in jQuery
You should go through the array ids[] and check if in JSON there is occurrence where the key Id has the value of each item in the array. You can use the method .filter() and check the data: var obj…
-
5
votes3
answers965
viewsA: List JSON data with Javascript
It’s because you’re wearing .html() when you should use .append(). The .html() will replace the HTML of the target element with each iteration in for, resulting only the code of the last for. Should…
-
1
votes1
answer830
viewsA: How to Break Automatic Line in a Textarea with Javascript or jQuery
Put a padding-right: 60px; in the textarea the text will not reach the button: $(document).ready(function(){ $("#mostrarMsg").hide(); $('#mensagem').keyup(function(e){ if (e.keyCode == 13){…
-
2
votes2
answers344
viewsA: Determine the amount of times a number can repeat in an array
An idea is already set from the beginning the number 3 times repeated and already include them in the array: $num3 = rand(1, 6); $array = array(); array_push($array,$num3,$num3,$num3); Then make a…
-
2
votes1
answer200
viewsA: Query records in table with jQuery
Use a function that removes accents from both the search term and the element text. The function tiraAcentos() returns the text already lowercase and without accents. Then you just put it in the…
-
0
votes1
answer27
viewsA: <input> Reject certain character
Just pick up the key code with onkeydown and return false if it is equal to 188 (alphanumeric keypad comma) or 110 (numeric keypad comma): document.getElementById("campo").onkeydown = function(e){…
-
1
votes1
answer194
viewsA: What is the difference between Media Query Pointer and Any-Pointer?
The difference between one and the other is that the inter will test only the primary pointing device (Primary Pointing device), as long as the any-Pointer will test anyone who has available and…
-
6
votes2
answers301
viewsQ: Div with position: Fixed loses total container width
In the example below, see that the div naturally occupies the whole width of the body, but when I click the button Fix to change the property position for fixed, it loses its full width, looking…
-
3
votes1
answer48
viewsA: Create div among others instead of at the end with Javascript
You can use the .insertBefore(). It inserts a new element before a given element within a parent. Example: var nova_div = document.createElement('div'); nova_div.innerText = 'NOVA DIV'; var pai =…
-
4
votes1
answer268
viewsA: How to make filter Blur pick up the whole element. Prevent Blur from ending before the end of the element background
When you apply Blur to div, I don’t see how to prevent the edges from being blurred. One way is to insert the background image into a child element (a span, for example) and apply overflow: hidden…
-
2
votes1
answer1043
viewsA: Calling Javascript in PHP
You’re using Javascript code inside a PHP block (<?php ?>). You must put the code inside the script tag: <script> // código aqui </script> But it is also necessary that the plugin…
-
1
votes1
answer227
viewsA: list Javascript events from a JSON in the Full Calendar (Events) library
Utilize: $('#calendar').fullCalendar('addEventSource', dados_agenda ); Documentation There is only one error in your JSON: missing a comma separating objects: },{…
-
1
votes1
answer55
viewsA: Capture a specific option in Javascript
Without tampering with HTML you can’t do that, because you don’t have any reference to know that one option is related to another, because they’re all sibling elements. You would solve this by…
-
0
votes2
answers56
viewsA: Questions on how to use javascript with visible and hidden fields
You can only use one event to do everything. Put the CSS class in: <style> .oculto{ display: none; } </style> And in the div#infos2 enter the class .oculto so that it is hidden from the…
-
0
votes2
answers437
viewsA: Div is bigger than Section
Exchange the height: calc(100% - 122px) for min-height: 100%. That’s because when using the calc, when the height of the viewport (window area) is less than the document height, the calc will cash…
-
1
votes1
answer39
viewsA: Reload video element with external link
The browser caches the video, so it’s no use just changing the src, it is necessary to resinserir the tag video whole (with the new src). Would look like this: var urlVideo =…
-
3
votes2
answers74
viewsA: Modify element placement using HTML and CSS
Utilize flexbox in class .grupo or .experiencia. In the example below, as there is already a block of properties for the class .grupo, just change the display: block for display: flex: body{…
-
0
votes2
answers109
viewsA: Links in the menu do not work with Javascript - Primefaces
You are making a bind on all links with the class .aw-item-link and making a event.preventDefault(): $('.aw-item-link').bind('click', function(event) { event.preventDefault();…
-
2
votes4
answers104
viewsA: Hover does not work
By HTML specifications, it is incorrect to use element <a> within another <a> as you are doing. By doing this, the browser will automatically close the first <a>, causing the…
-
1
votes3
answers140
viewsA: Problems with <Progress> tag stylization in CSS
Besides putting overflow: hidden, create a pseudo ::after to correct the edges. When zooming in on the browser, see how poorly the border looks with just the overflow: hidden: See now with the…
-
1
votes1
answer74
viewsA: Anchor links open a Javascript function
Looking at the plugin documentation, by default, it will grab all tags <a> as anchor of the gallery. What you should do is put a class in each tag <a> gallery, for example,…
-
2
votes1
answer375
viewsA: Mount HTML table using JSON AJAX
You call the function jsonTreatments() load and mount the table. Then in the first Ajax you call the function again making a .append() with the same data coming from the second Ajax, with this…
-
0
votes2
answers614
viewsA: Move fixed div along with browser scrollbar horizontally
Change the properties margin-top for top and use left: 0 to position the elements correctly. Then use the event scroll of window to toggle element properties when the .scrollLeft() is greater than…
-
4
votes2
answers71
viewsA: Alert when scroll reaches top of page
Just put a else if checking whether the scrolling has reached 0: I put a Math.ceil() in the example only to work correctly on the snippet. $('#messages').scroll(function() { if…
-
2
votes2
answers53
viewsA: Positioning of the third div
When using float: left all will be grouped to the right of the widgets. One way is to insert a div with clear: both; after the third div, avoiding that later elements are grouped to the right of the…
-
1
votes2
answers39
viewsA: Image is not displayed when reloading the page
I recommend changing the method .bind() (obsolete) by .on(). As for the code, you listed 4 events to be listened to by the object document: ready load scroll resize Of these 4, only the event scroll…
javascriptanswered Sam 79,597 -
0
votes1
answer49
viewsA: I need help defining an IF command
You can check if the element exists on the page with: if( document.querySelectorAll("div.error.flash__message").length ){ // existe }else{ // não existe } The…
-
0
votes1
answer35
viewsA: Place icon in list using CSS
By CSS there would be no way to insert an element <img> on the page, but you can use the property background-image to insert the icon as background image in the link. Just know the dimensions…
-
6
votes3
answers1025
viewsA: Dropdown with click
Only with CSS you could use one label with checkbox (hidden) only on the button that opens the submenu, instead of using a link <a>. When using a link <a> with href="#" only to open the…
-
1
votes2
answers85
viewsA: Link tag on Html5 in the wrong place on bootstrap
You can’t nest an element <a> within another <a>. The browser recognizes that this is wrong (because it is against the HTML specifications) and will close the first <a> to open the…
-
1
votes1
answer323
viewsA: Copy table cell by clicking button
First of all, there’s no way .select() in an HTML code. You can only use the method .select() in form elements (input, select, textarea etc.) The error is because you are selecting HTML (.html()) of…
-
1
votes1
answer1761
viewsA: Modify the style of a Checkbox by class [CSS]
Just replace the generic selector input[type=checkbox] by a class and place this class in the checkboxes you want to style. Those that don’t have the class will be in the default browser style:…
-
4
votes1
answer267
viewsA: Swap background-image with delay via jQuery
Use animate jQuery has to be careful because starting one on the same element before the other ends results in unexpected behavior. In this case, it would be better to use the callback in the first…
-
1
votes1
answer65
viewsA: Element positioned with position Absolute is expanding upwards
It lacked the property top, that you can use the value you find best at the distance from the top of the page (ex. top: 10px;): I put a button to remove the top to see the effect. function topo(){…
-
1
votes1
answer25
viewsA: Display data stored in the Weakmap object
I believe you’re overwriting the data with followed dadosPrivados.set, that is, the value of the object will be the last dadosPrivados.set which relates to sex. And the object rafael should pass…
-
1
votes1
answer77
viewsA: Switch from Section by clicking on menu
Hide only those that are visible, except the one you are showing/hiding (toggle). To do this use the selector :not and :visible. The :not is to exclude from the selector the target div of the event…
-
1
votes2
answers479
viewsA: A div cover the entire screen in CSS
You can do it with top, right, bottom and left properties, all with value 0. To center the image you can use transform with top, left and position, or use flexbox. With Transform: .load { position:…
-
1
votes1
answer151
viewsA: Datatable start with default value
Beyond what the @Robson Braga commented (first start component), you need to call two actions of component API: .search() and .draw(), otherwise you will only put a value in the "search" input…
-
1
votes1
answer23
viewsA: How to insert an imput into a combobox (CB) value via Javascript
Is that the value of the option selected is the client code. You need to grab the option text using textContent instead of value: function alimentarCampo() { var minhaLista =…