Questions tagged as 'javascript'

2
answers

Unusual way to use a function in jquery

This answer to a question brought something I did not know: a return with two pairs of brackets return[][] in a function, solving a problem in a simple but unknown way for me. The question asked for the return of the correct day...
asked by 15.12.2016 / 13:03
2
answers

Block PHP page to only show data if it is an AJAX request [duplicate]

I have a .php file that loads and displays all news from my database, I use this file to load the news dynamically with AJAX. So far so good, the user can usually go to the index.html page and see the news that has been uploaded...
asked by 22.08.2014 / 20:47
2
answers

How to use JavaScript to lock a key on the keyboard and display alert in the field on the recommended key?

How do I make a JavaScript to block the use of commas , within the field and at the same time also make an informed notification that only . is allowed and also verify that what the user entered is correct. I do not have much Ja...
asked by 01.11.2017 / 20:10
3
answers

Hover effect in JS

I have a problem that is as follows: I want the user to move the mouse on a certain image to another location and gain a class so that I can style it, can they help me? I'm trying this way: var $JQuery2 = jQuery.noConflict() $JQuery2(functi...
asked by 11.01.2018 / 18:44
3
answers

How would that code be in JQuery in pure JS?

This code snippet is to activate the .nav class but in JS there are some options like: classList.toggle('active-nav') But what about to disable when you click pure JS again? follow script with Jquery! $(document).ready(function(){ $(...
asked by 01.11.2017 / 16:05
1
answer

Do not allow insertion of a later date to another already inserted

I have an HTML form in which I give the user the ability to enter a start date and an end date, and of course I do not want the end date to be earlier than the start date. Inputs for the dates are of the "datetime-local" type. My goal would b...
asked by 22.03.2017 / 18:41
3
answers

Clearing form fields

I have the following encoding and would like to clear the form from all fields that have the same name . But I do not know why it does not clear the fields PS: What properties of input text can I use for this kind of thing?...
asked by 17.05.2018 / 20:47
3
answers

How to replace in html string only in texts within (between) tags?

I created a search that marks the text that was found. NOTE 1: The search is done in a string that is HTML. OBS 2: I check if there is text within that HTML through indexOf. OBS 3: If I find I give replace in all occurrences of th...
asked by 23.02.2015 / 18:32
2
answers

Is it possible to run a JavaScript function through PHP?

I want to run a function of JavaScript without "submitting" it, that is when the screen is accessed the php will call the function JavaScript and run what it has in it and then continue the normal code. It's possible? Note:...
asked by 13.10.2014 / 15:24
3
answers

How to persist the selected background even after reloading the page?

I have a site background change script: function bac(){ document.body.background = "img/1.png"; } <a href="#" onclick="javascript: bac();"> The user can choose which background image from the site, but when the page reloads, the...
asked by 25.11.2014 / 00:11