Most voted questions in Java-Script

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,429 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,307 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,616 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,712 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,837 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,789 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,037 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,109 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
825 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,643 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,150 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,034 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,789 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,565 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
931 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,456 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,741 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,650 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
617 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,873 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
400 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
324 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,687 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
595 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,026 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,302 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,305 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,407 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
352 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,925 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,885 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
791 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,421 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,403 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,546 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
344 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,823 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,676 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,819 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,604 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,093 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,084 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,654 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,906 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,874 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,283 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,770 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,390 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,037 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
497 views