Click To Edit

The click to edit pattern provides a way to offer inline editing of all or part of a record without a page refresh.

<div hx-target="this" hx-swap="outerHTML">
    <div><label>First Name</label>: Joe</div>
    <div><label>Last Name</label>: Blow</div>
    <div><label>Email</label>: joe@blow.com</div>
    <button hx-get="/contact/1/edit" class="btn btn-primary">
    Click To Edit
    </button>
</div>
<form hx-put="/contact/1" hx-target="this" hx-swap="outerHTML">
  <div>
    <label>First Name</label>
    <input type="text" name="firstName" value="Joe">
  </div>
  <div class="form-group">
    <label>Last Name</label>
    <input type="text" name="lastName" value="Blow">
  </div>
  <div class="form-group">
    <label>Email Address</label>
    <input type="email" name="email" value="joe@blow.com">
  </div>
  <button class="btn">Submit</button>
  <button class="btn" hx-get="/contact/1">Cancel</button>
</form> 
Server Requests : 2 ↑ Show
PUT /contact/1
parameters: {"firstName":"Tina","lastName":"Tester","email":"tina@wetator.org"}
Response
<div hx-target="this" hx-swap="outerHTML">
    <div><label>First Name</label>: Tina</div>
    <div><label>Last Name</label>: Tester</div>
    <div><label>Email Address</label>: tina@wetator.org</div>
    <button hx-get="/contact/1/edit" class="btn btn-primary">
    Click To Edit
    </button>
</div> 

Demo

: Tina
: Tester
: tina@wetator.org