ttmind

Main Navigation

ttmind
  • jim-jams
  • Tech
  • Positive
Login

Login

Facebook Google

OR

Remember me Forgot password?

Don't have account? Signup here.

Sort by Categorys

.Net

PHP

Java

JavaScript

Database

Server

Client Side

Tools

Artificial Intelligence

Cloud

Hybrid Development

Event

Smart City

Education

Security

Scrum

Digital Marketing

APP Development

Business

Internet

Simulation

Art

Network

Microservices

Architecture

Technology

Leadership

    Top Articles

  • How Does Social Media Bring People Together?
    TTMind Author
  • How to read appSettings JSON from Class Library in ASP.NET Core
    Anil Shrestha
  • Printing Support In Asp.Net Core
    TTMind Author
  • HOW TO EXTRACT TEXT FROM IMAGE USING JAVASCRIPT (OCR with Tesseract.js)?
    Prakash Pokhrel
  • Images Upload REST API using ASP.NET Core
    Prakash Pokhrel
  • Related Topic

  • How to Integrate reCAPTCHA in your website?
  • CSS Animation with cubic-bezier()
  • Simple Scroll Effect using JavaScript+JQuery.
  • Typewriter Effect using CSS
  • Invalid Scopes: pages_manage_instant_articles. This message is only shown to developers. Users of your app will ignore these permissions if present
  • Tech
  • About Us
  • Contact Us
  • TechHelp
  • PositiveHelp
  • Jim-Jams Help
  • Terms & Conditions

© Copyright ttmind.com

Main Content

What is ReadOnly and Disabled attribute in HTML?

Client Side HTML about 7 years ago || 12/6/2018 || 5.5 K View

  • Hide

What is ReadOnly and Disabled attribute in HTML?

ReadOnly attribute  is a  input type field  in HTML which specify read only function. ReadOnly attribute is a Boolean(Yes/No) attribute. Readonly field cannot be modified. The element will be enabled but its contents cannot be edited.The ReadOnly attribute is applied to input and Textarea.

Example of ReadOnly attribute

<html>
<title>Readonly</title>
<body>
  Name: <input type="text" name="Name" value="Manish" readonly><br>
  <input type="submit" value="Submit">
<body>
<html>

Disabled attribute in input field specifies that the input element is disabled. Disabled attribute is Bollean attribute.Disabled element in form cannot be submitted. The disabled attribute is applied in following field button,Fieldset,Input,Optgroup,option,select,Textarea, etc. The disabled attribute can be set to prevent  user from using the element till some specified condition has been met.

Example of  disabled button.

<html>
<title>Disabled</title>
<body>
<button type="button" disabled>Click Me!</button>
</body>
</html>

Difference between Readonly attribute and Disabled attribute.

Readonly attribute

1. TextBox and TextArea of Html input can be set as to ReadOnly.

2. Cursor can be shown in ReadOnly TextBox or TextArea.

3. Focus can be set in ReadOnly element.

4. During TAB navigation ReadOnly elenments are focused.

5. ReadOnly elements is sent to server during Form Submission.

 

 

Disabled attribute

1. All elements can be set as Disabled.

2. Cursor is not shown in Disabled TextBox and TextArea.

3. Focus cannot be set in Disabled element.

4. Elements which are disabled is  not focused during TAB navigation.

5. Datas of  disabled elements is not sent to server during Form Submission .

6.It  appears uncolored  in Browser.

Output of Readonly attribute

Output of Disabled attribute

  • 0
  • 0
  • 0
    • Facebook
    • Twitter
    • Google +
    • LinkedIn

About author

Manish Pandit

Manish Pandit

Reset Your Password
Enter your email address that you used to register. We'll send you an email with your username and a link to reset your password.

Quick Survey