Most viewed questions in Java-Script

0 votes
0 answers

How to generate unique ID with node.js?

This is my code: function generate(count) { ...READ MORE

Oct 9, 2020 in Java-Script by kartik
• 37,510 points
1,618 views
0 votes
1 answer

How do I pass variables and data from PHP to JavaScript?

Hello @kartik, Simply use one of the following ...READ MORE

Jul 6, 2020 in Java-Script by Niroj
• 82,880 points
1,553 views
0 votes
1 answer

Error:bundle install fails with SSL certificate verification error

Hello @kartik, Replace the ssl gem source with ...READ MORE

Jul 25, 2020 in Java-Script by Niroj
• 82,880 points
1,548 views
0 votes
0 answers

Response to preflight request doesn't pass access control check

I called a REST API on Amazon ...READ MORE

May 7, 2022 in Java-Script by narikkadan
• 63,420 points
1,537 views
0 votes
2 answers

How can I set focus on an element in an HTML form using JavaScript?

Hi Kartik, try the following script <script>  (window.onload = ...READ MORE

Sep 24, 2020 in Java-Script by Okugbe
• 280 points
1,528 views
0 votes
1 answer

How to pass an array as a function parameter in JavaScript?

Hello @kartik, Use: const args = ['p0', 'p1', 'p2']; call_me.apply(this, ...READ MORE

Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
1,519 views
0 votes
1 answer

How can I rename a database column in a Ruby on Rails migration?

Hello @kartik, Try using this: rename_column :table, :old_column, :new_column You'll ...READ MORE

Jul 24, 2020 in Java-Script by Niroj
• 82,880 points
1,356 views
0 votes
1 answer

How do I send a cross-domain POST request via JavaScript?

Hello @kartik, Follow this steps: Create an iFrame, put a ...READ MORE

Jul 27, 2020 in Java-Script by Niroj
• 82,880 points
1,330 views
0 votes
1 answer

How to sum the values of a javascript object

Certainly, I'd be happy to help you ...READ MORE

Sep 25, 2023 in Java-Script by Edureka
• 12,690 points
1,307 views
0 votes
1 answer

Which is the best Airbnb clone built with React?

Hello @rentall , For you query you can refer ...READ MORE

Oct 20, 2020 in Java-Script by Niroj
• 82,880 points
1,296 views
0 votes
1 answer

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

Include servlet-api-3.1.jar in your dependencies. Maven <dependency> <groupId>javax.servlet</groupId> ...READ MORE

Sep 20, 2022 in Java-Script by Abhinaya
• 1,160 points
1,258 views
0 votes
0 answers

When do Java generics require <? extends T> instead of <T> and is there any downside of switching?

Given the following example (using JUnit with ...READ MORE

Sep 29, 2022 in Java-Script by Abhinaya
• 1,160 points
1,252 views
0 votes
1 answer

Error:Callback of .animate() gets called twice jquery

Hiii @kartik, To get a single callback for ...READ MORE

Jun 2, 2020 in Java-Script by Niroj
• 82,880 points
1,248 views
0 votes
1 answer

How to add affiliate links automatically to blog post using javascript?

Hello @ Okugbe ,  You need few lines of code, ...READ MORE

Aug 10, 2020 in Java-Script by Niroj
• 82,880 points
1,206 views
0 votes
0 answers

NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

I'm a newbie to Fragments and custom ListView adapters. Can anyone ...READ MORE

Sep 20, 2022 in Java-Script by Tejashwini
• 780 points
1,201 views
0 votes
1 answer

How to get the directory of the currently running file?

Hello @kartik, This should do it: import ( ...READ MORE

May 6, 2020 in Java-Script by Niroj
• 82,880 points
1,180 views
0 votes
1 answer

How to resolve wait 5 seconds before checking whether the newState is -1?

Hello @kartik, You have to put your code ...READ MORE

Sep 2, 2020 in Java-Script by Niroj
• 82,880 points
1,154 views
0 votes
0 answers

Error: Can't set headers after they are sent to the client

I am using Node.js 4.10 and Express ...READ MORE

May 7, 2022 in Java-Script by narikkadan
• 63,420 points
1,150 views
0 votes
1 answer

What are XMLHttpRequest Object in Ajax?

 As, you are up to ajax so ...READ MORE

Jan 31, 2020 in Java-Script by Niroj
• 82,880 points
1,147 views
0 votes
0 answers

I Want To Print 1 to 100 Numbers Using Arrays In Javascript Only

<!DOCTYPE html> <html> <head> <title>100-Numbers</title> </head> <body> ...READ MORE

Nov 16, 2022 in Java-Script by Ashwini
• 5,430 points
1,130 views
0 votes
1 answer

How to get the file name from a full path using JavaScript?

Hello @kartik, Use this: var filename = fullPath.replace(/^.*[\\\/]/, '') This ...READ MORE

Sep 2, 2020 in Java-Script by Niroj
• 82,880 points
1,124 views
0 votes
0 answers

Jquery validation plugin - TypeError: $(...).validate is not a function

I am getting an error in my ...READ MORE

May 7, 2022 in Java-Script by narikkadan
• 63,420 points
1,120 views
0 votes
1 answer

How do I remove a property from a JavaScript object?

Objects in JavaScript can be thought of ...READ MORE

Jun 8, 2020 in Java-Script by Niroj
• 82,880 points
1,120 views
0 votes
1 answer

How can we change the page URL without refreshing the page?

Hello @kartik,  In HTML5 you can change the ...READ MORE

Apr 27, 2020 in Java-Script by Niroj
• 82,880 points
1,109 views
0 votes
1 answer

How to get value of selected radio button?

Hello @kartik, Use this: var rates = document.getElementById('rates').value; The rates ...READ MORE

Sep 2, 2020 in Java-Script by Niroj
• 82,880 points
1,082 views
0 votes
1 answer

Getting error while validating email address in JavaScript

Hello @Eureka , You are missing jquery library. Add ...READ MORE

Sep 9, 2020 in Java-Script by Niroj
• 82,880 points
1,066 views
0 votes
2 answers

error: Microsoft Visual C++ 14.0 is required

According to your question, it seems that ...READ MORE

Feb 8, 2022 in Java-Script by Rahul
• 9,670 points
1,066 views
0 votes
1 answer

Error: listen EADDRINUSE while using nodejs?

Hello kartik, Two possible solutions for this: Free currently ...READ MORE

Apr 24, 2020 in Java-Script by Niroj
• 82,880 points
1,062 views
0 votes
0 answers

What could cause java.lang.reflect.InvocationTargetException?

I've attempted to comprehend and read about potential causes, but I just don't get it: I have the following code try{ .. m.invoke(testObject); .. } catch(AssertionError e){ ...READ MORE

Sep 22, 2022 in Java-Script by Tejashwini
• 3,820 points
1,045 views
0 votes
0 answers

Why (null == false) and (null == true) both return false?

I am confused that why console.log(null == ...READ MORE

May 7, 2022 in Java-Script by narikkadan
• 63,420 points
1,027 views
0 votes
1 answer

How to get the current URL with JavaScript?

Hello @kartik, Use: window.location.href As noted in the comments, ...READ MORE

Aug 28, 2020 in Java-Script by Niroj
• 82,880 points
1,002 views
0 votes
0 answers

How to access PHP session variables from jQuery function in a .js file?

How to access PHP session variables from ...READ MORE

Jul 7, 2020 in Java-Script by kartik
• 37,510 points
993 views
0 votes
1 answer

How can I get query string values in JavaScript?

Hello @kartik, You don't need jQuery for that ...READ MORE

Jul 27, 2020 in Java-Script by Niroj
• 82,880 points
986 views
0 votes
1 answer

How to get the host url using javascript from the current page?

Hello @kartik, Use: var host = window.location.hostname; or possibly var host ...READ MORE

Oct 9, 2020 in Java-Script by Niroj
• 82,880 points
976 views
0 votes
1 answer

How can i insert data in relation table using model?

Hello @Alisha, Try to work using the model ...READ MORE

Aug 24, 2020 in Java-Script by Niroj
• 82,880 points
961 views
0 votes
0 answers

How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

My node version is: node -v v0.6.1-pre Then I install ...READ MORE

May 16, 2022 in Java-Script by Kichu
• 19,050 points
960 views
0 votes
1 answer

How to execute a function when page has fully loaded?

Hello @kartik, That's called load. It came waaaaay before ...READ MORE

Sep 23, 2020 in Java-Script by Niroj
• 82,880 points
951 views
0 votes
1 answer

How can I check if a checkbox is checked?

Hello @kartik, Try this: function validate() { var ...READ MORE

Oct 8, 2020 in Java-Script by Niroj
• 82,880 points
903 views
+1 vote
1 answer

How to implement up and down voting of a particular thread?

Hello @kartik, Yes, JavaScript is involved. There are ...READ MORE

Jun 3, 2020 in Java-Script by Niroj
• 82,880 points
882 views
0 votes
1 answer

How to validate an email address in JavaScript

Hello @kartik, To validate email use the below ...READ MORE

Jul 27, 2020 in Java-Script by Niroj
• 82,880 points
859 views
0 votes
1 answer

What is the “hasClass” function with plain JavaScript?

Hello @Kartik, Simply use classList.contains(): if (document.body.classList.contains('thatClass')) { ...READ MORE

Sep 2, 2020 in Java-Script by Niroj
• 82,880 points
835 views
0 votes
1 answer

How to clear all <div>s’ contents inside a parent <div>?

Hello @kartik, jQuery's empty() function does just that: $('#masterdiv').empty(); clears the master div. $('#masterdiv ...READ MORE

Oct 7, 2020 in Java-Script by Niroj
• 82,880 points
834 views
0 votes
1 answer

How do I select an element with its name attribute in jQuery?

Hello @kartik, You can use: jQuery('[name="' + nameAttributeValue + ...READ MORE

Jun 11, 2020 in Java-Script by Niroj
• 82,880 points
828 views
0 votes
1 answer

How to drop columns using Rails migration?

Hello @kartik, Use this: remove_column :table_name, :column_name For instance: remove_column :users, ...READ MORE

Jul 24, 2020 in Java-Script by Niroj
• 82,880 points
821 views
0 votes
1 answer

How to create HTML elements using jQuery?

Hello @kartik,  if you're doing $('<div>'), jQuery will also ...READ MORE

Sep 18, 2020 in Java-Script by Niroj
• 82,880 points
803 views
0 votes
1 answer

How to list the properties of a JavaScript object?

Hii @kartik, Use Reflect.ownKeys(): var obj = {a: 1, b: ...READ MORE

Jun 8, 2020 in Java-Script by Niroj
• 82,880 points
798 views
0 votes
0 answers

Generate pdf from HTML in div using Javascript

This is my HTML code: <!DOCTYPE html> <html> ...READ MORE

May 9, 2022 in Java-Script by Kichu
• 19,050 points
794 views
0 votes
1 answer

How do I remove documents using Node.js Mongoose?

Hello @kartik, If you don't feel like iterating, ...READ MORE

Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
785 views
0 votes
1 answer

How can I update NodeJS and NPM to the next versions?

Hello @kartik, First check your NPM version npm -v 1).Update ...READ MORE

May 5, 2020 in Java-Script by Niroj
• 82,880 points
779 views