
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

709 Views
To set the default value for an HTML element, we can use HTML selected attribute. It is used when you want to display a predefined value on your drop down menu. In this article we are having a dropdown list of four options, our task is to set the default value for an HTML select element. Steps to Set Default Value for select Element We will be following below mentioned steps to set the default value for HTML select element: We have created a dropdown list using select tag and then added options ... Read More

196 Views
In this tutorial, we will learn how to preselect a select list item using JavaScript. It is given an id attribute to be associated with a for accessibility purposes and a name attribute represents the name of the associated data point submitted to the server. element nestled inside the is used to define each menu option. Each element have a value attribute that contains the data value to submit to the server when that option is selected. If no value attribute is specified, the value is set to the text contained within the element.You can include ... Read More

4K+ Views
Submit button automatically submits a form on click. Using HTML forms, you can easily take user input. The tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc.Let’s learn about how to use the submit button in HTML forms. It is also created using HTML tag but type attribute is set to button.You can try to run the following code to use submit button to submit and reset a form. Under the action, attribute add the file, where you want to reach after ... Read More

44K+ Views
This tutorial teaches us how to reset or clear a form using JavaScript. This option is very helpful for users in the situation where they have filled the wrong form and before submitting they get to know about it and now they want to delete all the data. If the form is too large then manually deleting everything may be hard so it's better to use the reset() method of JavaScript. The reset() method is defined in JavaScript and by just clicking on it the form which will be linked to its onclick() method will reset every input section of ... Read More

5K+ Views
If you want to allow a user to upload an external file to your website, you need to use a file upload box, also known as a file select box. This is also created using the element but type attribute is set to file.ExampleLive DemoYou can try to run the following code to upload an external file to your website − File Upload Here are the attributes of the file upload box −Sr.NoAttribute & ... Read More

18K+ Views
Using HTML forms, you can easily take user input. The tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc.Let’s learn about the tag, which helps you to take user input using the type attribute. The attribute is used with the form elements such as text input, checkbox, radio, etc.ExampleYou can try to run the following code to take user input using HTML Forms:Live Demo HTML Forms ... Read More

441 Views
If your website is having a sufficient content and a good number of page views, then start adding some advertisements to earn money. Google AdSense is a free and easy way to earn money by placing ads on your website.Integrating Google AdSense on a website is quite easy. Let’s see the steps:Go to the official website and SIGN IN with the Google Account, which you want to use for AdSense.Setup the account will all the details i.e. website information, content language, etc.Read the Google AdSense Terms and Conditions and follow the Google rules. Also, read the Google Program Policies and do ... Read More

25K+ Views
To call a function on click event in JavaScript, you can use either the addEventListener method or the onclick event attribute. The addEventListener method is a general way to attach an event handler to a DOM element, and it allows you to specify the event and the callback function to be called when the event occurs. The onclick attribute is a specific event attribute that allows you to specify a JavaScript function to be called when the element is clicked. Both methods allow you to specify a function to be called when the element is clicked, but the addEventListener method ... Read More

9K+ Views
In this tutorial, we will learn how to include inline JavaScript inside an HTML page. Include inline JavaScript using onclick Event Just like an alert message showing up from the inline JavaScript inside an HTML page, we can also declare a function and call it. This method enabled us to write multiline code inside of a JavaScript function to do more tasks than just an alert message showing. In this example, we will change an element's text and background color by invoking a function from inline JavaScript code. Users can follow the syntax below to include inline JavaScript inside an ... Read More

2K+ Views
The HTML tag is used for declaring a script within your HTML document. Through this, you can define client-side JavaScript. But, what if you want to add external JavaScript inside an HTML Page? Well, you can easily do that too using the src attribute of the tag.The following are the attributes of the tag −AttributeValueDescriptionasyncasyncSpecifies that the script is executed asynchronously.charsetcharsetDefines the character encoding that the script uses.deferdeferDeclares that the script will not generate any content. Therefore, the browser/user agent can continue parsing and rendering the rest of the page.srcURLSpecifies a URI/URL of an external script.typetext/JavaScript application/ecmascript ... Read More