Skip to content

Commit

Permalink
target_id
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed May 18, 2024
1 parent 304f4d4 commit cc03a2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions 01_components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@
},
{
"cell_type": "code",
"execution_count": 80,
"execution_count": 85,
"id": "eb8a9099",
"metadata": {},
"outputs": [],
"source": [
"#| export\n",
"def A(txt, hx_get, target_id=None, hx_swap=None, href='#', **kw):\n",
" if target_id: target_id = '#'+target_id\n",
" return xt('a', txt, href=href, hx_get=hx_get, hx_target=target_id, hx_swap=hx_swap, **kw)"
" if target_id: kw['hx_target'] = '#'+target_id\n",
" return xt('a', txt, href=href, hx_get=hx_get, hx_swap=hx_swap, **kw)"
]
},
{
Expand Down Expand Up @@ -306,7 +306,7 @@
},
{
"cell_type": "code",
"execution_count": 84,
"execution_count": 86,
"id": "d211e8e2",
"metadata": {},
"outputs": [],
Expand Down
4 changes: 2 additions & 2 deletions fasthtml/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def Hidden(value:str="", **kw):

# %% ../01_components.ipynb 8
def A(txt, hx_get, target_id=None, hx_swap=None, href='#', **kw):
if target_id: target_id = '#'+target_id
return xt('a', txt, href=href, hx_get=hx_get, hx_target=target_id, hx_swap=hx_swap, **kw)
if target_id: kw['hx_target'] = '#'+target_id
return xt('a', txt, href=href, hx_get=hx_get, hx_swap=hx_swap, **kw)

# %% ../01_components.ipynb 10
def set_val(tag, attr, val):
Expand Down

0 comments on commit cc03a2d

Please sign in to comment.