Posts by Samir Braga • 10,016 points
275 posts
-
23
votes6
answers3120
viewsA: How can we not allow numbers in a textbox?
You can do this using a Regular Expression. Look: $('#nome_contacto').on('input', function(e) { if(/[0-9]/g.test(this.value)){ alert("Apenas letras"); } }); In this case the expression was /[0-9]/g…
-
2
votes1
answer36
viewsA: Checkbox enabled count
Instead var n = $( "input:checked" ).length; Put this on: var n = $( "input:enabled:checked" ).length;
javascriptanswered Samir Braga 10,016 -
2
votes1
answer2867
viewsA: How to capture the value of a paragraph within a div?
The first thing you should do is capture these elements. You can do this through a id, as follows: HTML <h4 id="cantor">CANTOR</h4> <h5 id="musica">MÚSICA</h5> Javascript To…
-
1
votes1
answer589
viewsA: Right column of fixed site
I didn’t find many ready examples of how to do this, so I decided to do it myself. See if this is what you want: I believed a div with the class="sideBar" which may have several articles, the…
-
0
votes3
answers167
viewsA: Alignment of Divs
All the other answers gave very good ways of how you can do this, but here’s a functional example with a few more considerations. First off, I made you a reset with a box-sizing: border-box;, its…
-
1
votes3
answers1629
viewsA: Create a div that occupies 100% of the screen width?
Try adding a margin: 0 to that div, and a margin: 0; padding: 0; at the body. Would look like this: body{ margin: 0; padding: 0; } .top-bar { position: relative; width: 100%; height: 60px;…
-
1
votes1
answer111
viewsA: Html css text alignment
As the question had no details, I created a model from the image: I believed a div with the class="pictureContainer" and assigns it the following style: .pictureContainer{ width: 400px; height:…
-
1
votes2
answers783
viewsA: Select chained using only HTML and jQuery
Just do this: $('#regiao option').on('click', function(){ var value = $( "#regiao option:selected").val(); $('#uf option').css('display', 'none'); $('.' + value).css('display', 'block');…
-
1
votes2
answers408
viewsA: Responsive content with fixed size sidebar
One way to do this is in your example, by reversing the order of the elements article and aside. To the aside which in the code is written before the article, a float: right, and the desired width…
-
5
votes2
answers706
viewsA: How to toggle images when clicking a checkbox?
You can do this with this simple javascript function, with Jquery: If you had the same image for all Abels and only rotated the images, you would have to do this only once. As follows…
-
2
votes1
answer814
viewsA: Sort by number with Datatables
Try to add that to your dataTable aoColumns: [{ sSortDataType: 'dom-text', sType: 'numeric' }, null] But before he puts this: $.fn.dataTableExt.afnSortData['dom-text'] = function (oSettings,…
-
5
votes2
answers1453
viewsA: as a tool to leave a FULL SCREEN slide
See if that solves your problem: Put a height: 100% in the body. Then create a class .full and give her a height: 100%: .full{ height: 100%; } Then apply this class to: Cointainer-Fluid: <div…
-
2
votes3
answers73
viewsA: as by values within objects
The logic for that would be very simple: var widgets = { options: { label: null, icon: null } }; var span = document.getElementsByTagName("span")[0]; widgets.options.label =…
-
4
votes1
answer2111
viewsA: Problems to sum values using Angular JS
Well, as I said, I took a look without your code and did some reworking. At least here it’s working... Reformulations In Javascript 1. Remove the delete $scope.numeros of function adicionar(). I…
-
6
votes3
answers838
viewsA: Uncheck a checkbox by clicking outside of it
Well if you really want to use the checkBox, you can do so: var checkbox = $('#button-menu'); $('body').not('#menu').click(function() { checkbox.prop("checked", false); }); $('#button-menu,…
-
2
votes2
answers150
viewsA: Leave effect smoother and random
See if this is what you wanted, the randomness I got with Jquery. setInterval(function(){ var random1 = (Math.floor(Math.random()*(60-50))+50); var random2 = (Math.floor(Math.random()*(55-45))+45);…
cssanswered Samir Braga 10,016 -
0
votes4
answers249
viewsA: Box of different height fit equal Pinterest
Erick what I’ve achieved regarding your doubt is the call Layout Grid Masonry which is almost the same thing as the Waterfall of Rboschini’s response, it is well applied here. Initially, he is done…
-
2
votes2
answers467
viewsA: Back button - Level above or Previous page
My opinion: If you have this back button on your page, it will really be up to you. The browser back button will already do the back function, which I do not prevent you from having the same…
htmlanswered Samir Braga 10,016 -
0
votes1
answer27
viewsA: Firing a method . scroll on mobile device
Try to do so: $(document).on("scrollstart", function (e) { var active = $.mobile.activePage[0].id; if (active == "pg_remote-address-book") { $('.exemplo').css('color', "black"); } else {…
-
5
votes2
answers4198
viewsA: Do a string check?
I made a version that checks gradually what you specified in the question. $('#test').keyup(function(){ var value = $(this).val(); var letras, numeros, letrasMaiusculas, especial;…
-
3
votes4
answers959
viewsA: How to do a background cover on a separate div?
See if this is what you wanted: *{ padding: 0; margin: 0; border: 0; } body, html{ height: 100%; } #esquerda{ width: 30%; height: 500px; background:…
-
2
votes1
answer158
viewsA: Dynamically Change Bar Percentage
I reworked your function to give a load in progressBar, take a look: I created the function changePercentage(), on it you inform the progress bar that you want the load. If you only tell…
-
2
votes1
answer88
viewsA: jQuery resizable() does not drag the panel-footer
What I did was add to your class panel one min-height, so that there would be a decrease that would cause the objects to collide, and a overflow: hidden so that what was inside the panels did not…
-
4
votes1
answer543
viewsA: Clickable 3D globe
Well, for starters, when you speak in 3D in javascript, I advise you to have one in the library Threejs. There is a huge range of complete examples with the most varied purposes that can help you in…
-
4
votes2
answers294
viewsA: What is the correct way to return a "switch" value?
Well, the switch has this structure: switch (expression) { case value1: //Instruções executadas quando o resultado da expressão for igual á value1 break; case value2: //Instruções executadas quando…
-
5
votes1
answer80
viewsA: Regex not to escape just < > =?
Try this, it will make him accept only the characters < > ! =: /[<>=!]/g Example: https://regex101.com/r/eF5pG8/1 Already this will make him accept everything except the characters <…
regexanswered Samir Braga 10,016 -
4
votes2
answers1452
viewsA: How to create an animated Progressbar to inform the strength of the password?
You can use a method to create a progression through Divs: function progress(percent, $element, velocity) { percent = percent >= 100 ? 100 : percent; var progressBarWidth = percent *…
jqueryanswered Samir Braga 10,016 -
0
votes1
answer61
viewsA: Doubt with Regex
Well, what I wanted with the capture of these numbers/expressions was to simulate the action of the exponential function with the signal ^. I got a way to do it, but it wasn’t just with regex.…
-
4
votes3
answers6440
viewsA: How to check if an item is contained in an array?
Try to do so: $scope.verificaVogal = function(nome) { var dados = {}; for (id = 0; id < nome.length; id++) { if (angular.uppercase(nome[id]) in {'A':'', 'E':'', 'I':'', 'O':'', 'U':''}) {…
-
2
votes2
answers162
viewsA: How to count state changes in fields with a certain class within a function?
Well, basically what I understand is that you want to capture the changes of each element of the class ocultosOuOpcionais and then add them up: Capturing the difference in characters As explained in…
-
3
votes1
answer61
viewsQ: Doubt with Regex
Good night. I need a regular expression that can capture the numbers/expressions before and after a certain character, like this one ^. For example, in the string below I need her to return me (5 *…
-
2
votes1
answer125
viewsA: Email Marketing other than HTML
If you are referring to the alignment of the text, the difference is in the second table: Incorrect code: <table align="center" cellspacing="0" cellpadding="0" style="margin: 0px;…
-
0
votes1
answer1130
viewsA: How to show the value of a variable that is in another html page
Since you just want to capture the value of the variable in any extension that opens in the notepad, I advise you to do this with javascript. In archive1 .js must have: var x = 10; var y = 20; var z…
-
1
votes2
answers1515
viewsA: Align menu with CSS
Just put a display: inline-block in his li. According to your code works perfectly. #videoGallery ul { margin: 0; padding: 0; } #videoGallery span { display: block; background-color: #4682b4; color:…
-
0
votes1
answer71
viewsA: Tutorial data Binding as Angularjs
Good evening. Your question is quite interesting and I have created a certain interest in this problem. After some researches I listed some articles (I hope you understand a little English :) that…
javascriptanswered Samir Braga 10,016 -
3
votes3
answers1209
viewsA: Get the name of the Image in the URL
If your image name always has that same number of characters, you can do this: var url = "/data/data/com.intel.appx.IZICondominios.xwalk15/files/_pictures/picture_006.jpg";…
-
1
votes1
answer138
viewsA: Uncaught Referenceerror: takepic is not defined (Intel XDK)
Try it like this: function takepic() { intel.xdk.camera.takePicture(10, true, "jpg"); } document.addEventListener("intel.xdk.camera.picture.add", function(event) { var nomeFoto = event.filename; var…
-
1
votes1
answer114
viewsA: Customer side image manipulation
There are some very interesting library options, such as: http://fabricjs.com/ Example: http://fabricjs.com/clipping/ http://paperjs.org/ Example: http://paperjs.org/examples/path-simplification/…
-
1
votes2
answers816
viewsA: Turn vertical gallery to horizontal
I’ve set up a more responsive way for your model. Instead of setting the image size, there is a "cut" of them, so they do not get distorted. I used images examples. The way it is just put your…
cssanswered Samir Braga 10,016 -
3
votes2
answers1588
viewsA: How to submit a form by pressing "enter"?
In the manner below it will verify whether something was written by means of the regular expression /\w/, ignoring the white spaces. Edited example: $("#buscar").on("blur", function(e) { verify(e);…
jqueryanswered Samir Braga 10,016 -
3
votes1
answer320
viewsQ: Capture dynamically created element index
I intend to create a seemingly very simple function. My code is this: var coordenates = $(".coordenates"); var add = $('.add'); var remove = $('.remove'); var newCoordenate = '<div…
-
1
votes1
answer639
viewsA: Send textarea text to div
See if that solves your problem: var username = "João"; //exemplo var id = "_qrt4"; //exemplo var element = '<div class="popup-box chat-popup" id="'+ id +'">'; element = element + '<div…
javascriptanswered Samir Braga 10,016 -
4
votes3
answers490
viewsA: Displays and hides contents in list form. with Javascript
Make sure it fits you. Use the same button principle: I imagine that example might satisfy you I merged the two previous examples: var buttons = $('ul li'); var videos = $('#videoGallery div'); var…
-
9
votes5
answers6529
viewsA: How to create buttons to increase/decrease font?
I’m using the previous answer and adapting it to a script that works for all tags, including those belonging to a Parent within the element itself. In this case, one should only choose a parent…
-
1
votes1
answer519
viewsA: How to calculate percentage in top css property?
First of all, a clarification, I imagine you already know, but emphasizing, the property top will only work with enlightenment of property position, and that choice must be well made, as you can…
cssanswered Samir Braga 10,016 -
0
votes2
answers1159
viewsA: How to limit the number of houses before the comma in a regular expression?
I imagine this one might satisfy you: /^(\d{1,5})?(\.\d{1,2})?$/ Here dry an example on HTML of validation: $('input').keyup(function(e){ var val = this.value; var test = /^(\d{1,5})?(\.\d{1,2})?$/…
-
1
votes3
answers407
viewsA: Keyup allow it to contain only one dot between input characters
Well... it gave me a certain job, but I think I finally got something quite interesting. Look: With the existence of a point, if you try to add another after this you will not be able, for that the…
-
3
votes3
answers5447
viewsA: Remove element Focus using pure Javascript
Try this, it is proposed in case you have several elements with the class="btn". You will use the same function blur(): var btn = document.getElementsByClassName("btn"); for (var i = 0; i <…
javascriptanswered Samir Braga 10,016 -
1
votes2
answers916
viewsA: CSS animation: control which element respects the screen size limits
Just add a margin-left: -40px, since the #circle has a width: 40px. Running here: https://jsfiddle.net/3xt9zc6c/1/ @keyframes anima{ 0%{ top: 0px; left: 0px; } 50%{ top: 0px; left: 100%;…
-
3
votes1
answer3986
viewsA: How to align checkbox and label with bootstrap
See if this fits you: label { display: inline-block; } input { padding: 0; margin:0; vertical-align: center; position: relative; top: 1px; overflow: hidden; } <script…