# כיצד ליצור פונקציית עזר של Handlebars

**URL:** <https://meta.discourse.org/t/how-to-create-a-handlebar-helper-function/214407>\
**Category:** Development\
**Created:** [10 בינואר,‏ 2022,‏ 4:26pm UTC](https://meta.discourse.org/t/how-to-create-a-handlebar-helper-function/214407 "2022-01-10T16:26:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)\
**Post date:** [11 בינואר,‏ 2022,‏ 1:23pm UTC](https://meta.discourse.org/t/how-to-create-a-handlebar-helper-function/214407/4 "2022-01-11T13:23:49Z")

</div>

Your code should work, but you’re using your helper

```Handlebars
{{sample}}

```

in the template without passing it any arguments. Even if you’re testing to see if things work, pass it a test string like

```Handlebars
{{sample "some string"}}

```

You need to do that because you’re using the helper in a raw `hbr` template. For testing purposes, the helper should work even if you don’t pass it anything in regular `hbs` templates.

If you’re creating a block-helper, then it needs to have `#` and you need to close it like so.

```Handlebars
{{#sample}}

{{/sample}}

```

Adding `~` to your helper optionally trims whitespace between any HTML tags it returns. So

```Handlebars
{{~#sample}}

{{/sample}}

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-create-a-handlebar-helper-function/214407)._
