
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

8K+ Views
The standard alert box in JavaScript does not provide the option to apply CSS. To style your alert box, you need to create a custom one first. The custom alert box will be created using jQuery and styles will be applied to CSS.ExampleYou can try to run the following code to learn how to create and apply CSS to alert box −Live Demo function functionAlert(msg, myYes) { var confirmBox = $("#confirm"); confirmBox.find(".message").text(msg); ... Read More

10K+ Views
In this tutorial, we will learn to stop a video with JavaScript on YouTube. Using the ‘iframe’ HTML element, we can easily embed the YouTube videos on our application. It is a video player in HTML 5 and has many attributes that users can use according to their needs. In some cases, it happens that you want to create a custom pause or stop button for the embedded YouTube video. Customized buttons are always pretty rather than default ones, making UI pretty. So, we will learn two different methods to create the custom stop button for the YouTube videos. However, ... Read More

185 Views
The void operator is used to evaluate the given expression. After that, it returns undefined. It obtains the undefined primitive value, using void(0) i.e. 0 as an argument.The void(0) can be used with hyperlinks to obtain the undefined primitive value, ExampleLive Demo Understanding JavaScript void(0) Click me not once, but twice. We used JavaScript:void(0) above to prevent the page from reloading when the button is clicked the first time.The code will only work when the button will be clicked twice. If it is clicked once, ... Read More

108 Views
The JavaScript void returns an expression to remove the side effect and return the undefined primitive value. This side effect may occur while inserting expression in a web page.Let’s see an example of the void. The void(0) can be used with hyperlinks to obtain the undefined primitive value, ExampleLive Demo Understanding JavaScript void(0) Click me not once, but twice. We used JavaScript:void(0) above to prevent the page from reloading when the button is clicked the first time.The code will ... Read More

1K+ Views
To use an image on a webpage, use the tag. The tag allows you to add image source, alt, width, height, etc. The alt is the alternate text attribute, which is text that is visible when the image fails to load.The following are the attributes −AttributeDescriptionAltThe alternate text for the imageHeightThe height of the imageIsmapThe image as a server-side image-mapLongdescThe URL to a detailed description of an imageSrcThe URL of an imageUsemapThe image as a client-side image-mapWidthThe width of the imageJust keep in mind the tag has no end tag.ExampleYou can try to run the following code to ... Read More

349 Views
The void keywordThe void is an important keyword in JavaScript, which can be used as a unary operator that appears before its single operand, which may be of any type. This operator specifies an expression to be evaluated without returning a value.The syntax of the void can be either of the following two − The eval() functionThe JavaScript eval() is used to execute an argument. The code gets execute slower when the eval() method is used. It also has security implementations since it has a different scope of execution.ExampleHere’s how you can ... Read More

5K+ Views
To make an anchor tag refer to nothing, use “javascript: void(0)”. The following link does nothing because the expression "0" has no effect in JavaScript. Here the expression "0" is evaluated, but it is not loaded back into the current document.ExampleLive Demo Click the following, This won't react at all... Click me!

706 Views
In this article, we will learn the difference between JavaScript undefined and void(0). Though they may appear similar, they serve distinct purposes and can be used in different scenarios. What is JavaScript undefined? undefined means a variable declared, but no value has been assigned. It is a primitive value automatically assigned to variables that have been declared but not initialized. For Example − var demo; alert(demo); //shows undefined alert(type of demo); //shows undefined It is a global property that represents a variable with no assigned value. If a function does not return ... Read More

290 Views
In this tutorial, let us discuss how to use the void keyword in JavaScript. We use the void keyword as the return type of function that does not return any value. It evaluates an expression and returns undefined. We can use this with a single operand because this is a unary operator. We should not wrap the expression in parentheses because void is not a function. void 0 is the same as void(0). Users can follow the syntax blocks to deal with each use case. Syntax void expression The expression can be a variable or a function. Use void ... Read More