Latest questions in Java-Script

0 votes
0 answers

Sort array of objects by string property value

I have this array of JavaScript objects: var objs ...READ MORE

May 10, 2022 in Java-Script by Kichu
• 19,050 points
632 views
0 votes
0 answers

How can I create a two dimensional array in JavaScript?

Is it possible to create a two-dimensional ...READ MORE

May 9, 2022 in Java-Script by Kichu
• 19,050 points
584 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
0 answers

Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>)

I was trying to change a string ...READ MORE

May 9, 2022 in Java-Script by Kichu
• 19,050 points
6,451 views
0 votes
0 answers

What is the difference between React Native and React?

May 7, 2022 in Java-Script by narikkadan
• 63,420 points
359 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,026 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
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
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,149 views
0 votes
0 answers

How do I format a date in JavaScript?

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

How do I redirect to another webpage?

How do I redirect users to a ...READ MORE

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

jQuery checkbox change and click event

Have shared an approach which will add ...READ MORE

Feb 23, 2022 in Java-Script by Aditya
• 7,680 points
40,086 views
0 votes
1 answer

Open a URL in a new tab (and not a new window)

Nothing an author can do can choose ...READ MORE

Feb 23, 2022 in Java-Script by Aditya
• 7,680 points
2,670 views
0 votes
1 answer

Format JavaScript date as yyyy-mm-dd

You could try using the following lines ...READ MORE

Feb 23, 2022 in Java-Script by Aditya
• 7,680 points
4,271 views
0 votes
0 answers
0 votes
1 answer

Hi, how does one kill the whatsapp message loop with a code instead of closing whatsapp-web?

Hello @Felix , Use this code: <script> function simulateMouseEvents(element, eventName) ...READ MORE

Oct 20, 2020 in Java-Script by Niroj
• 82,880 points
2,047 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,294 views
0 votes
1 answer

How to access a RowDataPacket object?

Hello @kartik, Turns out they are normal objects ...READ MORE

Oct 14, 2020 in Java-Script by Niroj
• 82,880 points
8,416 views
0 votes
1 answer

How do I search for a key of object in javascript?

Use hasOwnProperty(key) for (let i = 0; i ...READ MORE

Oct 14, 2020 in Java-Script by Niroj
• 82,880 points
2,083 views
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,616 views
0 votes
1 answer

How to get browser width using JavaScript code?

Hello @kartik, Use this code: var w = window.innerWidth; var ...READ MORE

Oct 9, 2020 in Java-Script by Niroj
• 82,880 points
1,817 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
974 views
0 votes
1 answer

How to get the anchor from the URL using jQuery?

Hello @kartik, For current window, you can use this: var ...READ MORE

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

How to get the URL without any parameters in JavaScript?

Hello @kartik, This is possible, but you'll have ...READ MORE

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

How to disable HTML button using JavaScript?

Hello @kartik, To disable document.getElementById("btnPlaceOrder").disabled = true; To enable document.getElementById("btnPlaceOrder").disabled ...READ MORE

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

How to to get the key of a key/value javascript object?

Hello @kartik, You would iterate inside the object ...READ MORE

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

How can I submit a form using JavaScript?

Hello @kartik, Set the name attribute of your form to "theForm" and ...READ MORE

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

Error:Uncaught SyntaxError: Unexpected token

Hello @kartik, Using the jQuery command getJSON and ...READ MORE

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

How to detect when a user leaves a web page using javascript?

Hello @kartik, Try the onbeforeunload event: It is fired just ...READ MORE

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

How do I link a JavaScript file to a HTML file?

Hello @kartik, This is how you link a ...READ MORE

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

How to get the value of an input field using ReactJS?

Hello @kartik, Managed to get the input field ...READ MORE

Oct 8, 2020 in Java-Script by Niroj
• 82,880 points
13,792 views
0 votes
1 answer

How is the 'use strict' statement interpreted in Node.js?

Hello @kartik, "use strict"; Basically it enables the strict ...READ MORE

Oct 8, 2020 in Java-Script by Niroj
• 82,880 points
2,980 views
0 votes
1 answer

How can I determine the type of an HTML element in JavaScript?

Hello @kartik, nodeName is the attribute you are looking ...READ MORE

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

How can I set multiple CSS styles in JavaScript?

Hello @kartik, Using Object.assign: Object.assign(yourelement.style,{fontsize:"12px",left:"200px",top:"100px"}); This also gives you ability to ...READ MORE

Oct 8, 2020 in Java-Script by Niroj
• 82,880 points
3,184 views
0 votes
1 answer

How do I break a string across more than one line of code in JavaScript?

Hello @kartik, In your example, you can break ...READ MORE

Oct 8, 2020 in Java-Script by Niroj
• 82,880 points
496 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
0 votes
1 answer

How to get the url parameters using AngularJS?

Hello @kartik, To use params simply append them ...READ MORE

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

How to test if a string is JSON or not?

Hello @kartik, Use JSON.parse function isJson(str) { ...READ MORE

Oct 8, 2020 in Java-Script by anonymous
• 82,880 points
3,666 views
0 votes
1 answer

How to convert HTML string into DOM elements?

Hello @kartik, You can use a DOMParser, like so: var ...READ MORE

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

How to add `style=display:“block”` to an element using jQuery?

Hello @kartik, Try this: $("#YourElementID").css("display","block"); Or $("#YourElementID").css({ display: "block" }); Hope it ...READ MORE

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

How to find the operating system version using JavaScript?

Hello @kartik, Try this: var OSName = "Unknown"; if (window.navigator.userAgent.indexOf("Windows ...READ MORE

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

How to set Value of Input Using Javascript Function?

Hello @kartik, Try for YUI Dom.get("gadget_url").set("value",""); with normal Javascript document.getElementById('gadget_url').value = ''; with ...READ MORE

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

How can I only detect click event on pseudo-element?

Hello @kartik, This is not possible; pseudo-elements are ...READ MORE

Oct 7, 2020 in Java-Script by anonymous
• 82,880 points
23,982 views
0 votes
1 answer

How do I use format() on a moment.js duration?

Hello @kartik, Use this: // set up let start = ...READ MORE

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

How to remove all listeners in an element?

Hello @kartik, I think that the fastest way ...READ MORE

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

How could I call that function from the command line in nodejs?

Hello @kartik, In your db.js, export the init function. There are ...READ MORE

Oct 7, 2020 in Java-Script by Niroj
• 82,880 points
9,142 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 to call onChange event after pressing Enter key?

Hello @kartik, You can use onKeyPress directly on ...READ MORE

Oct 7, 2020 in Java-Script by anonymous
• 82,880 points
10,718 views
0 votes
1 answer

How to get function parameter names/values dynamically?

Hello @kartik, The following function will return an ...READ MORE

Sep 23, 2020 in Java-Script by Niroj
• 82,880 points
2,175 views