Posts by Samir Braga • 10,016 points
275 posts
-
1
votes2
answers44
viewsA: How do you show only the shops of the selected neighborhood?
Ney, you just do like this: $('.selectBairro p').click(function(){ var bairro = $(this).text(); $('.loja').hide(); $('.loja p:contains(' + bairro + ')').parent().show(); }) <script…
-
3
votes1
answer308
viewsA: Link HTML elements
Look this example I made in Jsfiddle. The javascript was this: $(document).ready(function() { $("#panel").draggable(); $(".div").draggable(); $("#panel").droppable({ accept: ".div", drop: function()…
-
19
votes1
answer7086
viewsA: What is the difference between Factory, service or controller in Angular?
The controller would be the mediator leading of his model and its view. In it you would make the necessary manipulations for interaction with the services of your application. When I say services, I…
angularjsanswered Samir Braga 10,016 -
5
votes1
answer1993
viewsA: How to calculate currency by appearing decimal places in JS?
Instead of parseInt(), use parseFloat(). The parseInt transforms into whole numbers, that is, without decimals. Already the parseFloat transforms into any operable number. function multiplica() {…
javascriptanswered Samir Braga 10,016 -
2
votes1
answer224
viewsA: Leading vs line-height
In your last doubt I believe the differences in the application of line-height will depend a lot on the rest of your layout. See this example: ul#lista1{ line-height: 40px; } ul#lista2 li{…
-
1
votes2
answers409
viewsA: dynamic value inheritance of a child input (unordered list)
See if this is what you wanted: Write something on the first input. $('input:text').keyup(function(){ var id= $(this).attr('id'); $('input[data-herdar="' + id + '"]').val(this.value); }); <script…
-
1
votes3
answers818
viewsA: How to configure a dynamic dimension div delimited by other div’s?
Similar to the idea already posted there is this way: body{ margin: 0; padding: 0; height: 100%; padding: 50px 0; } header, footer{ height: 50px; width: 100%; background: #333; position: fixed; }…
-
2
votes2
answers42
viewsA: How to do with objects on a page at a certain width to group vertically?
You can use the Media Querie of css: .container { width: 100%; height: 1000px; } .col { display: inline-block; background: #333; width: 30%; height: 300px; margin: 2px 0; } @media (max-width: 500px)…
-
3
votes1
answer930
viewsA: Event change is only triggered when changing tab or changing window
The event change in a input, can sometimes cause this kind of problem. Look at this example: $('input').change(function(){ $('span').text(this.value) }) <script…
-
1
votes1
answer126
viewsA: Problems with Append and slideToggle
At the event click you can do so: $(document).on("click", ".auto .postagens .comentarios .linkComentario", function (event) { event.preventDefault();…
jqueryanswered Samir Braga 10,016 -
1
votes2
answers6280
viewsA: How to leave a div and an image over a Carousel?
See if this is what you wanted: #fixa{ height: 100%; width: 50%; background: rgba(15, 215, 115, 0.5); z-index: 10; position: absolute; } <link…
-
3
votes2
answers865
viewsA: Create octagonal border button using html and css only
HTML & CSS Well, it wasn’t an easy task, but it worked: body{ background: gold; } #octagon { width: 100px; height: 50px; background: white; position: relative; line-height: 45px; text-align:…
-
1
votes2
answers1086
viewsA: Regular expression to detect the credit card flag when there are specific characters in the number
Try that expression: ((\d{16}|(.?\d){16})|(\d{4}(\d{4}){3})) If you want to accept more than one specific character between the numbers you can simply do so: ([^0-9]*\d{1}){16} If you want to…
regexanswered Samir Braga 10,016 -
2
votes1
answer320
viewsA: toastr.js disabling the required HTML5 property
Well, the main reason for this is that you’re using the method .preventDefault(), on a button submit, that is, it will not cause the form to be submitted. Validation by required only happens at the…
-
2
votes2
answers8899
viewsA: Cannot read Property '0' of Undefined, prototype incompatibility
An alternative solution: Like itens is an array of objects used a forEach, and captured the index. I did the same in letras[letra], since k was also an index capture attempt: var itens =…
-
5
votes1
answer1909
viewsA: How do I know if the browser scroll is near the height of the div?
To capture the scrollTop(), use the: var scrollTop = $('html, body').scrollTop(); To verify the top of the element in question, use the .offset().top, there is also the .position().top, but this…
-
2
votes1
answer876
viewsA: How to add the logo to the fixed menu after a certain scroll on the page?
On the site you left as an example, they may or may not have made 2 menus, usually, no, this does not happen, what happens is a class change, as in your code. In it will be no different, one that…
-
3
votes3
answers268
viewsA: How do Javascript functions behave in relation to the scope?
Going by parts: First, your variable is objeto present in the $(document).ready(... does not possess the var logo it declared in the global scope (reusable in all functions within the script), this…
-
3
votes2
answers69
viewsA: IF to check quantity needed for given KG
An option with Jquery: var barricas = $('#qtd40kg'); var bisnagas = $('#qtd3kg'); $('#peso').on('input', function(){ var pesoTotal = $(this).val(); var x = Math.floor(pesoTotal%40); var y = x/3;…
-
5
votes1
answer3090
viewsA: doubts with Angularjs, input and onblur() method
If your function is within the scope of your controller, you can simply do so using the ng-blur: <input type="text" ng-blur="getCep()"> If not, do so with the onBlur even: <input…
angularjsanswered Samir Braga 10,016 -
2
votes2
answers881
viewsA: Change div background on Hover
Just use the :hover css of the element you want: .i-circle:hover{ background: yellow; } Behold: i { margin: 40px 0; color: #CCC; font-size: 5rem; } .i-circle { height: 150px; width: 150px;…
-
12
votes3
answers2164
viewsA: What is the use of the two points in Javascript?
Well, the use of the two points is basically employed in objects: var frutas = { "banana":{ cor: "yellow" } } With the object you simply "navigate" between key levels: frutas.banana.cor; // yellow…
javascriptanswered Samir Braga 10,016 -
4
votes6
answers3282
viewsA: Is there a Javascript class?
Here are some very basic examples, to understand logic in a very simple way, in addition to the ways already posted: There are calls Factory Functions or factory functions. They function as objects.…
-
5
votes1
answer86
viewsQ: In what situations use each prototype type in HTML elements?
In "prototypes" I have used several times the Element.prototype and the HTMLElement.prototype. I wanted to know what is each and what is the difference between them in example, if possible. Because…
-
5
votes3
answers11523
viewsA: Putting two Yes and No buttons on a Javascript message
You can use the tag <dialog> of HTML5 to create a constumized window: function AcaoLimpar(){ $('form input:text').val(''); } var dialog = $('#window'); $('#show').click(function() {…
-
5
votes2
answers200
viewsA: How do I show the description of a T-shirt when I click on it?
First of all, there are some small errors in your code: The source tag <img> is passed by the parameter src, even because it doesn’t "close" this tag, look how it should look: <img…
-
2
votes1
answer415
viewsA: How to create arrow-shaped edges on the sides of a div
Just use these styles: .arrow_box:after { border-color: rgba(136, 183, 213, 0); border-right-color: #88b7d5; /* border-right ao invés de border-top */ border-width: 30px; left: 0; /* Left 0 as setas…
-
8
votes2
answers17302
viewsA: Add more fields in form dynamically in Jquery
Using the example you passed in the question, just add this to your .append(): .append('<div><input type="text" name="Texto' +(+wrapper.find("input:text").length+1) '" /><a href="#"…
-
1
votes1
answer213
viewsA: How to change an attribute, javascript
Your method used as an example is the problem, the offsetTop is a method get, and not set. That is, with it you can only get values and not declare them or change them. In the case as the offsetTop…
javascriptanswered Samir Braga 10,016 -
3
votes3
answers221
viewsA: I wanted to know how to make each page refresh to . class be moved
I made a very simple way to do this. See if it fits your example: $('.item').each(function(i){ var rdm = Math.floor(Math.random()*$('.item').length-1) $(this).before($('.item').eq(rdm)); }) In case,…
-
2
votes1
answer87
viewsA: How to return object relative object?
If by "relative," you mean Parent (father). You can use the .parentNode or the .parentElement. They work as follows: <div> <h1 id="myTitle" >Title</h1> </div>…
javascriptanswered Samir Braga 10,016 -
1
votes1
answer34
viewsA: Moving (drag) three Ivs at the same time and disabling with a checkbox
After a good research I found a kind of improvement of this function multiDraaggable(). You can see it here: https://github.com/wizztjh/MultiDraggable/blob/master/multidraggable.js He basically adds…
-
0
votes1
answer217
viewsA: Javascript Onrowclick Returns to HTML With All Row
In the function call onRowClick() I added the following code: var rowsValue = row.getElementsByTagName("td"), value = []; // Array que receberá os textos de cada TD for (var i = 0; i <…
-
2
votes1
answer1522
viewsA: How to concatenate a string and an integer value in javascript?
From what I saw in your code, the problem is in the structuring: Your script has a function that, at least to what you have shown, is declared but is not called. Possible solutions: Add function to…
-
1
votes2
answers1914
viewsA: Enable and disable function in jquery
As a complement to the Tobymosque answer, I leave an option with a very similar effect, but done in Jquery. To add an event in jquery you can use the .bind(), already to remove this event can use…
-
3
votes1
answer242
viewsA: Nan Error in Calculation using Javascript after click Submit
I made some modifications. Look below: 1. The main problem is that you are using in most selectors for the checkbox, only input, without specifying your type. For example: var n =…
-
3
votes1
answer4084
viewsQ: Back-end applications with Node.js
I’ve seen some lectures on the Node.js, its capacity, usability, market, etc... But all this information was very "scrambled" for me, and I always had a somewhat vague thought about it. What I know,…
-
1
votes4
answers82
viewsA: Doubt with height in a DIV
Another way is a height: auto, but with a min-height: 100%. Jsfiddle html, body{ height: 100%; } #header { width: 100%; height: 65px; line-height: 65px; vertical-align: middle; overflow: hidden;…
-
4
votes2
answers384
viewsA: "Text" type input similar to the Stack Overflow tag system
As a complement to Guilherme Nascimento’s great response, I leave here a "handmade" option of this tag system. You can check below: function tagCreator(par) { par.append('<div…
-
6
votes1
answer1235
viewsA: How to effect "Hover" in SVG icon?
From what your question says, I imagine you wanted something like this: .agenda { fill: #333; } .agenda:hover { opacity: 0.5; } <img…
-
6
votes1
answer2234
viewsA: Manipulating an open window from the parent window with Javascript
A way of manipulating window of window.open() is keeping your declaration in a variable. For example: var win = window.open("pagina.html", "", "width=400, height=400"); In the above example, you…
-
2
votes1
answer2227
viewsA: How to create HTML table inside javascript
How did I realize that your data select came from an object, I made a way to create a dynamic table from a array of objects. I imagine it is similar to what you have in the example of the question.…
-
3
votes2
answers214
viewsA: How do I do other Jquery effects?
In the jquery documentation you have the complete list of effects of the library itself. The main ones are: .animate() .fadeIn() .fadeOut() .fadeToggle() .show() .hide() .sildeUp()and its variations…
-
2
votes2
answers9847
viewsA: How to remove this line break?
Try to give a replace thus: str_replace("> <", "><", $texto); If this doesn’t work the problem may be with quotation marks. Has a colspan="5", double quotes instead of single quotes. As…
-
3
votes2
answers360
viewsA: Page mode landscape does not fit
See if that’s what you wanted: What I did was remove the .block:before, as you said, and added to .img-responsive one margin: auto to center. Already the div.block and to the body instead of a…
-
4
votes1
answer45
viewsA: Is it possible to select all elements with a certain class with CSS only?
I imagine that’s what you mean: select.form-control{ /* seu style */ } The css class selector is the point . The element specified above is optional, could be only .form-control…
-
2
votes1
answer153
viewsA: Pass Javascript Output to a field
See if this is what you wanted: Basically, I created these variables: var resultadoInput = document.getElementById('resultado_soma2'); var checkCount = document.getElementById('checkcount2'); And to…
javascriptanswered Samir Braga 10,016 -
11
votes2
answers1164
viewsA: What are the differences between the "vw", "em" and "%" font sizes?
The units mentioned have very similar use, but with very different utilities, I will tell you some things that the Iron Man already said, however, I will give a more detailed: vw, vh, vmin, Vmax…
cssanswered Samir Braga 10,016 -
0
votes3
answers3722
viewsA: How to extend a DIV to the end of the screen?
First you must give to the body one height: 100% And to your right-side menu, the same. It would look like this: body{ height: 100% } .menu_lateral{ height: 100%; } The body has a standard height:…
-
2
votes1
answer510
viewsA: How to create fields dynamically when selecting a value in the checkbox?
Well, this can be done in some ways, it will depend on what exactly you want with these text boxes. I wrote an example that takes into account the order of the elements, that is, if you have marked…