Latest questions in Java-Script

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,052 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,804 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,587 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
946 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,503 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,762 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,707 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
623 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,891 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,883 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
409 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
334 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,715 views
0 votes
0 answers

How to create a <style> tag with Javascript?

I'm looking for a way to insert ...READ MORE

Sep 21, 2020 in Java-Script by kartik
• 37,510 points
603 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,062 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,346 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,339 views
0 votes
2 answers

How to change website favicon dynamically?

There is a way of doing it ...READ MORE

Sep 28, 2020 in Java-Script by anju
• 160 points
4,453 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
361 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
3,964 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,920 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
799 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,440 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,441 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,623 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
352 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,850 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,708 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
21,957 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,668 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,122 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,110 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,712 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,949 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,968 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,316 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,799 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,411 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,056 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
527 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,821 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,357 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,612 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,130 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,406 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
781 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,516 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,908 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
610 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,296 views