Questions tagged as 'javascript'

3
answers

How to execute code only on the first click?

I have a list of buttons ( <li> ): <li id="1">link 1</li> <li id="2">link 2</li> <li id="3">link 3</li> <li id="4">link 4</li> <li id="5">link 5</li> When the user clic...
asked by 14.04.2015 / 06:39
3
answers

Traversing objects with pure JavaScript

I need to list objects and I have used the following function that is in jQuery. Is there an alternative to this in JavaScript only? $.each(object, function(index, value) { console.log(value); });     
asked by 04.10.2015 / 16:24
4
answers

Check if string has only numbers

What command can I use to know if a string contains only numbers? For example, I'm using prompt : var quantidade=prompt('Quantidade de entrada de produtos(somente números)'); I would like to check if actually in the variable qua...
asked by 01.04.2014 / 16:46
2
answers

How can I create a regular expression that accepts a certain number at most once

I'm learning how to use Regex and would like to know if I can get it to accept a maximum of 2 in some sequence (it may contain letters or numbers) Eg: "sskfdam09471928" Approved "asldk02210920139" Disapproved by repeating twice     
asked by 03.07.2018 / 23:05
3
answers

How to replace a given string inside another Javascript string?

How can I replace only a certain part of a string ? Example: var linha_nova = "EU TENHO UM CACHORRO"; I want to replace only the word "UM" with another. How should I proceed? I also need to replace with the known position of the...
asked by 24.05.2014 / 20:10
3
answers

How to change a text variable to number value?

I have this segment of code, I would like someone to help me in transforming the variable P (in which it takes the attribute 'value') and transform it into number value for the sum. $(document).ready(function(e) { $('.pizzad...
asked by 03.12.2016 / 01:41
4
answers

Function to check if number is prime in JavaScript

In PHP I would use: for($i = 3; $i <= ceil(sqrt($num)); $i = $i + 2) { if($num % $i == 0) return false; } What is the function to do the verification using JS?     
asked by 09.04.2015 / 04:14
1
answer

Get the value of the selected item in a ComboBox in classic asp

I have two combobox, I need to get the id of one to load the other from the item that was selected in combobox1, how could I do this through a javascript function. <select id="cb_catinsumo" class="combo" name="cb_catinsumo" class="combo2"&g...
asked by 23.04.2014 / 19:54
3
answers

How to insert an element between two elements?

Explanation: I have a <div> parent that contains two <div> daughters, however I would like to insert a <table> using javascript, between, that is, in the middle of these two <div> daughters...
asked by 19.02.2014 / 20:49
2
answers

References for web programming learning [closed]

What sites can I check to start studying web programming? I'm a beginner on the subject.     
asked by 06.12.2014 / 13:42