ic-replace-target - The Replace Target Attribute


The ic-replace-target attribute tells Intercooler the target element of the intercooler request should be replaced entirely with the server response, rather than replacing the inner HTML of the target.

This is useful in cases where you cannot wrap an element around a potential target easily, such as table rows.


The value of the ic-target attribute should be "true", or it should be omitted entirely.

This attribute may be placed on parent elements, allowing you to specify behavior across multiple elements.


ic-replace-target has no effect on dependencies..


Here is a simple button that replaces an entire div, rather than just the content in the div. You can tell by the lack of border afterwards.

  <div id="target" style="border: 1px solid red">Before</div>
  <button ic-post-to="/update" ic-target="#target" ic-replace-target="true">Update Div</button>

Note that the response to the button click is the content to swap in for the div, not the button.