Skip to content

Commit 0e17b5b

Browse files
authored
Fix JS.hide selector examples (#4239)
Use the supported selector option only when hiding an element other than the command source.
1 parent 41570e8 commit 0e17b5b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

guides/client/syncing-changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ For example, imagine that you want to immediately remove an element from the pag
129129
If the element you want to delete is not the clicked button, but its parent (or other element), you can pass a selector to hide:
130130

131131
```heex
132-
<button phx-click={JS.push("delete") |> JS.hide("#post-row-13")}>Delete</button>
132+
<button phx-click={JS.push("delete") |> JS.hide(to: "#post-row-13")}>Delete</button>
133133
```
134134

135135
Or if you'd rather add a class instead:

lib/phoenix_live_view/js.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ defmodule Phoenix.LiveView.JS do
12471247
## Examples
12481248
12491249
```heex
1250-
<div id="modal" phx-remove={JS.hide("#modal")}>...</div>
1250+
<div id="modal" phx-remove={JS.hide()}>...</div>
12511251
<button phx-click={JS.exec("phx-remove", to: "#modal")}>close</button>
12521252
```
12531253
"""

0 commit comments

Comments
 (0)