Question: I have a search form

```
<input id="price_from" value="price from ">
<input id="price_to" value="price to ">
<button>search</button>

```

How can I disable editing of dafault text? When user starts to type in price amount it's not possible to edit "price from " and "price to " but they stay in input field. I've tried different mask plugins for jquery but they didn't show default text untill you focus on field and don't provide option for custom text. Only placeholders an chars.

Answer: 
I don't think all the other answerers understood the question correctly. The question requires disabling editing **part of the text**. One solution I can think of is simulating a textbox with a **fixed** prefix which is not part of the textarea or input.

An example of this approach is:

```
<div style="border:1px solid gray; color:#999999; font-family:arial; font-size:10pt; width:200px; white-space:nowrap;">Default Notes<br/>
<textarea style="border:0px solid black;" cols="39" rows="5"></textarea></div>

```

The other approach, which I end up using is using JS and JQuery to simulate "Disable" feature. Example with pseudo-code (cannot be specific cause of legal issue):

```
  // disable existing notes by preventing keystroke
  document.getElementById("txtNotes").addEventListener('keydown', function (e) {
    if (cursorLocation < defaultNoteLength ) {
            e.preventDefault();
  });

    // disable existing notes by preventing right click
    document.addEventListener('contextmenu', function (e) {
        if (cursorLocation < defaultNoteLength )
            e.preventDefault();
    });

```

Thanks, Carsten, for mentioning that this question is old, but I found that the solution might help other people in the future.
So, i came across this problem in angular and I made a directive to solve this problem. so my problem was with social link urls. so my directive is some what like..

below are my input fields with default urls:

```
<input type="text" formControlName="twitter" id="twitter" class="form-control inputBox" placeholder="URL" defaultValue>

```

and my directive with name "defaultValue" is:

```

import { Directive, ElementRef, HostListener } from '@angular/core';

@Directive({
  selector: 'input[defaultValue]',
})
export class DefaultValueDirective {
  constructor(private _el: ElementRef) {}

  @HostListener('input', ['$event']) onInputChange(event) {
    const element = this._el.nativeElement;
    console.log(element);
    switch (element.id) {

      case 'twitter':
        if (!element.value.includes('https://www.twitter.com/')) {
          this._el.nativeElement.value = 'https://www.twitter.com/';
          event.stopPropagation();
        }
        break;

    }
  }
}

```

Hope it works for you.