Most answered questions in Java-Script

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,189 views
0 votes
1 answer

How to get the size of a JavaScript object?

Hello @kartik, Use this code: function roughSizeOfObject( object ) ...READ MORE

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

How to reject in async/await syntax?

Hello @kartik,  throw an Error wrapping the value, which results in ...READ MORE

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

How to stop event propagation with inline onclick attribute?

Hello @kartik, Use event.stopPropagation(). <span onclick="event.stopPropagation(); alert('you clicked inside the ...READ MORE

Sep 23, 2020 in Java-Script by Niroj
• 82,880 points
2,608 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
956 views
0 votes
1 answer

How to Get local IP address in node.js?

Hello @kartik, os.networkInterfaces(), — an object, that maps ...READ MORE

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

How do I disable right click on my web page?

Hello @kartik, You can do that with JavaScript ...READ MORE

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

How to pass arguments to addEventListener listener function?

Try this: const someInput = document.querySelector('button'); someInput.addEventListener('click', myFunc, false); someInput.myParam ...READ MORE

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

How do I measure the execution time of JavaScript code with callbacks?

Hello @kartik, Use the Node.js console.time() and console.timeEnd(): var i; console.time("dbsave"); for(i = 1; ...READ MORE

Sep 23, 2020 in Java-Script by Niroj
• 82,880 points
626 views
+1 vote
1 answer

How to download a file from NodeJS Server using Express?

Hello @kartik, Express has a helper for this as: app.get('/download', function(req, ...READ MORE

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

How to remove all child elements of a DOM node in JavaScript?

Hello @kartik, Use modern Javascript, with remove! const parent = ...READ MORE

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

How do I declare a namespace in JavaScript?

Hello @kartik, Try this: var yourNamespace = { ...READ MORE

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

How to delete a cookie using javscript?

Hello @kartik, Try this: function delete_cookie( name, path, domain ...READ MORE

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

How to copy static files to build directory with Webpack?

Hello @kartik, Requiring assets using the file-loader module ...READ MORE

Sep 21, 2020 in Java-Script by Niroj
• 82,880 points
6,730 views
0 votes
1 answer

How to get the focused element with jQuery?

Hello @kartik, // Get the focused element: var $focused ...READ MORE

Sep 21, 2020 in Java-Script by Niroj
• 82,880 points
5,081 views
0 votes
1 answer

How do I add a delay in a JavaScript loop?

Hello @kartik, The setTimeout() function is non-blocking and will return ...READ MORE

Sep 21, 2020 in Java-Script by Niroj
• 82,880 points
7,379 views
0 votes
1 answer

How can I insert a line break into a <Text> component in React Native?

Hello @kartik, This should do it: <Text> Hi~{"\n"} this is a ...READ MORE

Sep 21, 2020 in Java-Script by Niroj
• 82,880 points
15,371 views
0 votes
1 answer

How to retrieve GET parameters from javascript?

Hello @kartik, This code gives you GET without ...READ MORE

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

How to Obtain form input fields using jQuery?

Hello @kartik, Try this: $('#myForm').submit(function() { ...READ MORE

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

How to reset <input type = “file”> using javascript?

Hello @kartik, You need to wrap <input type = ...READ MORE

Sep 18, 2020 in Java-Script by Niroj
• 82,880 points
5,939 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 detect a 'touch screen' device using JavaScript?

Hello @kartik, Use this: function is_touch_device() { ...READ MORE

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

How to disable scrolling temporarily?

Hello @kartik, Do it simply by adding a ...READ MORE

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

How to remove all line breaks from a string?

Hello @kartik, Windows would be \r\n, but Linux just ...READ MORE

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

How to get current date and time in JavaScript?

Hello @kartik, To get time and date you ...READ MORE

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

How to trigger an ajax request when the user has finished typing in a text box?

Hello @kartik, Use the code below: //setup before functions var ...READ MORE

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

How to uncheck a radio button?

Hello @kartik, either (plain js) this.checked = false; or (jQuery) $(this).prop('checked', ...READ MORE

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

How to run JavaScript code before page load?

Hello @kartik, You can use window.onpaint for such ...READ MORE

Sep 9, 2020 in Java-Script by Niroj
• 82,880 points
22,061 views
0 votes
1 answer

How do I access ViewBag from JS?

Hello @kartik, in your view write : <script> var ...READ MORE

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

How to check Page.Validate() on client side (JavaScript) in ASP.Net?

Hello @kartik, Page_ClientValidate() will work. It returns true if ...READ MORE

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

How to return JSON with ASP.NET & jQuery?

Hello @kartik, You need to do something like ...READ MORE

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

How to disable asp.net button after click to prevent double clicking?

Hello @kartik, On the front end, add these ...READ MORE

Sep 9, 2020 in Java-Script by Niroj
• 82,880 points
7,742 views
0 votes
1 answer

How can I read the client's machine/computer name from the browser?

Hello @kartik, You can do it with IE ...READ MORE

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

How to embed an External Page Without an Iframe?

Hello @kartik, You could load the external page ...READ MORE

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

How to Determine if page is valid in JavaScript - ASP.NET?

Hello @kartik,  Make the call on an input ...READ MORE

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

How to disable postback on an asp Button in System.Web.UI.WebControls.Button?

Hello @kartik, Use this: <asp:button runat="server".... OnClientClick="myfunction(); return false;" ...READ MORE

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

How to Change the selected value of a drop-down list with jQuery?

Hello @kartik, With hidden field you need to ...READ MORE

Sep 9, 2020 in Java-Script by Niroj
• 82,880 points
2,417 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,078 views
0 votes
1 answer

How can I check the existence of an element in jQuery?

Hello @ Arpit In JavaScript, everything is 'truthy' or ...READ MORE

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

How to change programmatically the src of an img tag?

Hello @kartik, Give your img tag an id, ...READ MORE

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

How do I call a JavaScript function on page load?

Hello @kartik, If you want the onload method ...READ MORE

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

How to convert an Object {} to an Array [] of key-value pairs in JavaScript?

Hello @kartik, You can use Object.keys() and map() to do this var obj ...READ MORE

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

verbose stack Error: missing script: start

Hello @kartik, It looks like you might not ...READ MORE

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

How to add many functions in ONE ng-click?

Hello @kartik, You have 2 options : Create a ...READ MORE

Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
3,442 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
790 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,524 views
0 votes
1 answer

How to adjust width and height of iframe to fit with content in it?

Hello @kartik, <script type="application/javascript"> function resizeIFrameToFitContent( iFrame ) { ...READ MORE

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

How can I make a div stick to the top of the screen once it's been scrolled to?

Hello @kartik, Using javascript: var initTopPosition= $('#myElementToStick').offset().top; ...READ MORE

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

How to clear cache in Yarn?

Hello @kartik, Run: yarn cache clean. Hope it helps!! Thank you! ...READ MORE

Sep 4, 2020 in Java-Script by Niroj
• 82,880 points
3,307 views
–1 vote
1 answer

How to read an external local JSON file in JavaScript?

Hello @kartik, For reading the external Local JSON ...READ MORE

Sep 3, 2020 in Java-Script by Niroj
• 82,880 points
182,669 views