Trending questions in Java-Script

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

How can I pass PHP objects to javascript?

Hello @kartik, You can convert the PHP object ...READ MORE

Jul 7, 2020 in Java-Script by Niroj
• 82,880 points
5,076 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
980 views
0 votes
1 answer

How to check if the URL contains a given string?

Hello @kartik, You would use indexOf like this: if(window.location.href.indexOf("franky") != -1){....} Also ...READ MORE

Jun 11, 2020 in Java-Script by Niroj
• 82,880 points
6,091 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
905 views
0 votes
1 answer

How can I remove or replace SVG content?

Hello @kartik, Setting the id attribute when appending ...READ MORE

Jun 18, 2020 in Java-Script by Niroj
• 82,880 points
5,758 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,125 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,733 views
0 votes
1 answer

How do I parse JSON with Ruby on Rails?

Hello @kartik, Use  hash = JSON.parse string Rails should automagically ...READ MORE

Jul 25, 2020 in Java-Script by Niroj
• 82,880 points
4,137 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
838 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
681 views
0 votes
1 answer

Error :jquery's .ajax() method not sending my session cookie

Hello @kartik, AJAX calls only send Cookies if ...READ MORE

Aug 25, 2020 in Java-Script by Niroj
• 82,880 points
2,596 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,818 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
461 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
497 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,530 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
437 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
448 views
0 votes
1 answer

How can I check whether a radio button is selected with JavaScript?

Hello @kartik, You can use vanilla JavaScript way var radios ...READ MORE

Sep 3, 2020 in Java-Script by Niroj
• 82,880 points
1,848 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
955 views
0 votes
2 answers

How to animate a change in backgroundColor using jQuery on mouseover?

You don't need jquery. You can also ...READ MORE

Sep 9, 2020 in Java-Script by Eureka
• 160 points
1,658 views
0 votes
1 answer

How to dynamically load JS inside JS?

Hello @kartik, The script is not added to ...READ MORE

Aug 25, 2020 in Java-Script by Niroj
• 82,880 points
2,205 views
0 votes
1 answer

How do I modify the URL without reloading the page?

Hii @kartik, HTML5 introduced the history.pushState() and history.replaceState() methods, which allow you ...READ MORE

Jun 20, 2020 in Java-Script by Niroj
• 82,880 points
5,061 views
0 votes
1 answer

Error: Cannot resolve module 'style-loader'

Hello @kartik, Try  to run script below: npm install ...READ MORE

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

How can I specify a local gem in my Gemfile?

Hello @kartik, In order to use local gem ...READ MORE

Jul 24, 2020 in Java-Script by Niroj
• 82,880 points
3,337 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 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
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 decode the url in php where url is encoded with encodeURIComponent()?

Hello @kartik, Use this function: <?php $string = 'http%3A%2F%2Fexample.com'; $output = ...READ MORE

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

How to select and manipulate CSS pseudo-elements such as ::before and ::after using jQuery?

Hii @kartik, Here is the way to access ...READ MORE

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

Parse Error: Adjacent JSX elements must be wrapped in an enclosing tag

Hello @kartik, You  just need to put your ...READ MORE

Jun 8, 2020 in Java-Script by Niroj
• 82,880 points
5,149 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,074 views
0 votes
1 answer

Error:jQuery.parseJSON throws “Invalid JSON” error due to escaped single quote in JSON

Hello @kartik, Striking a similar issue using CakePHP ...READ MORE

Jun 19, 2020 in Java-Script by Niroj
• 82,880 points
4,611 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
607 views
0 votes
1 answer

How to render raw html with AngularJS?

Hello @kartik, You need to add ng-bind-html="data.text" to your h1 ...READ MORE

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

How to check if a specific key is present in a hash or not?

Hello @kartik, While Hash#has_key? gets the job done, as it has ...READ MORE

Jul 24, 2020 in Java-Script by Niroj
• 82,880 points
3,039 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
412 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,155 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 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,129 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
341 views
0 votes
1 answer

How to detect if URL has changed after hash in JavaScript?

Hello @kartik, Use this code window.onhashchange = function() { ...READ MORE

Jun 18, 2020 in Java-Script by Niroj
• 82,880 points
4,406 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,087 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 rollback a specific migration?

Hello @kartik, Try this: rake db:migrate:down VERSION=20100905201547 will roll back ...READ MORE

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

SyntaxError: expected expression, got '<'

Hii @kartik, This code: app.all('*', function (req, res) { ...READ MORE

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

How to Intercept call to the back button in my AJAX application?

Hello @kartik, It is very easy toi disable ...READ MORE

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

How can I allow django admin to set a field to NULL?

Hello @kartik, Try to overwrite the save() method ...READ MORE

Jun 12, 2020 in Java-Script by Niroj
• 82,880 points
4,470 views
0 votes
1 answer

How to use React Router with Laravel?

Hii Kartik, Create a route that maps everything ...READ MORE

Apr 29, 2020 in Java-Script by Niroj
• 82,880 points
6,327 views