Questions tagged as 'javascript'

2
answers

How do I get the title of an image by JavaScript?

How do I get the title of an image and display it on a alert ?     
asked by 16.02.2016 / 14:06
3
answers

Add element to the beginning of a key / value object

I have the following object: var exemploLista = { "Igor": "exemplo1.jpg", "Joao": "exemplo2.jpg" }; And I'm using this code to add an item to the object: exemploLista["Lucas"] = "exemplo3.jpg"; But in this way, giving consol...
asked by 26.01.2016 / 19:59
3
answers

JavaScript Doubt (Loopin through an array using a for loop)

In this Example below, I have more specific doubts in these Code lines. I would like to know in detail if possible, its functions! Doubt: for (i = 0; i < myObj.cars.length; i++) { x += myObj.cars[i] + "<br>"; Example:...
asked by 11.01.2017 / 12:26
4
answers

Show and hide div

I need to make a function that when just clicked on the div with the last class is visible and the rest is hidden. <a href="javascript:teste('minhaDiv');" class="expander">Link</a> <a href="javascript:teste('minhaDivo');" class=...
asked by 18.11.2016 / 18:32
5
answers

How to access the value of an array through the key?

I have the following array: var arr = [ {'David': '1'}, {'Camilla': '2'}, {'Sadat': '3'}, {'Vanuza': '4'}, {'Diego': '5'} ]; I wanted to access the "Camilla" value of the array I created. Ps: I want to access the value of the key...
asked by 31.03.2016 / 23:04
3
answers

Limit of characters in input

I want to build a jQuery that applies a limit of 255 characters within input . My idea and do something like this: $(".loading").on('input', function () { // aqui eu tenho que fazer o bloqueio });     
asked by 27.04.2017 / 18:18
2
answers

Javascript - How to make input return to its normal state after validation

I'm working on a form which if the person does not fill in the fields, the <input> is left with a red border, and below is the name "Required field". It's working fine, but I need it when the person completes the field it returns...
asked by 28.08.2016 / 01:39
3
answers

Passing HTML Parameters to Javascript

Good afternoon, people! I need to pass parameters from a small HTML form to a Javascript function but I have already tried it anyway and it does not work! Where am I going wrong? function pessoa(nome) { this.nome = nome; } v...
asked by 23.10.2018 / 18:01
4
answers

How to know which checkboxes are selected?

How do I make a javascript code to know which checkboxes are selected and when I find it, get the value data-id of it? <input type="checkbox" data-id="1"> <input type="checkbox" data-id="2"> <input type="checkbox" data-id...
asked by 31.07.2018 / 17:53
4
answers

Check if parameter exists in URL javascript

I have a URL that may or may not contain parameters in it. Ex: www.site.com.br/?id=1 or www.site.com.br . I need to check if there is any parameter in this URL and with that I can add one more at the end. For example: If URL...
asked by 10.09.2018 / 18:25