Pre-select Option in HTML on Page Load

Jennifer Nicholas
Updated on 03-Mar-2020 11:10:09

150 Views

Use the selected attribute to specify that the option should be pre-selected when page loads in HTML. You can try to run the following code to implement selected attribute −Example           HTML selected attribute               Here's the list of subjects. Select any one:                             Computer Architecture             Java             Discrete Mathematics                    

Specify Styles for Parent and Child Elements in HTML

seetha
Updated on 03-Mar-2020 11:09:27

267 Views

Use the scoped attribute to specify that the styles only apply to the parent element and the element’s child elements −Example                    h2 {             color:yellow;          }                                           h2 {                color:grey;             }                    Grey Heading             Yellow Heading    

Specify Required Fields in HTML Forms

vanithasree
Updated on 03-Mar-2020 11:05:03

762 Views

The required attribute in HTML is used to specify that the element should be filled before the form is submitted. If the field is not filled and the submit button is clicked, an error generates, which fails form submission. The error will be “Please fill out this field”.The required attribute can be used on input, select and textarea element.ExampleYou can try to run the following code to implement readonly attribute −           HTML placeholder attribute               Register                                    

Set Relationship Between Current Document and Linked Document in HTML

Govinda Sai
Updated on 03-Mar-2020 11:04:19

216 Views

Use the rel attribute to see the relationship between the current document and the linked document. It works for , , HTML elements. ExampleYou can try to run the following code to implement rel attribute. The example sets the CSS files −                         Heading       This is demo content.    

Set the Name of the Element in HTML

Abhinanda Shri
Updated on 03-Mar-2020 10:29:05

288 Views

Use the name attribute to set the name of the element. You can use this with the following HTML elements: , , , , , , , , , , , ExampleYou can try to run the following code to implement name attribute −           Subject:       Add an incorrect spelling for a word above and see what happens.       This is an editable conttent, with a spelling mistake. Click to edit.    

Set Video Audio Output to Mute in HTML

Sreemaha
Updated on 03-Mar-2020 10:27:59

403 Views

Use the muted attribute to set the audio output of the video to mute. You can try to run the following code to implement muted attribute −Example                                        Your browser does not support the video element.          

Specify Minimum Value in HTML

Sravani S
Updated on 03-Mar-2020 10:21:41

156 Views

Use the min attribute to add the minimum value in HTML. You can try to run the following code to implement min attribute −Example                    Rank:                              

Specify HTTP Method for Sending Form Data in HTML

Smita Kapse
Updated on 03-Mar-2020 10:20:50

267 Views

Use the method attribute to specify the HTTP method to use when sending form-data in HTML.ExampleYou can try the following code to implement method attribute −        HTML option Tag                                     HTML             Ruby                              

Execute a Script When Media Length Changes in HTML

Nikitha N
Updated on 03-Mar-2020 10:18:52

245 Views

The ondurationchange attribute triggers when the length of the audio/ video changes in HTML.ExampleYou can try to run the following code to implement ondurationchange attribute −                                        Your browser does not support the video element.                      function display(vLength) {             alert("Video Length: " + vLength.duration + " seconds");          }          

Add Maximum Value to HTML

radhakrishna
Updated on 03-Mar-2020 10:15:45

133 Views

Use the max attribute to add the maximum value in HTML. You can try to run the following code to implement max attribute − Example                    Rank:                              

Advertisements