Textinput masking with alpine not working

The following code gives an error about not able to find $input. This is code from the v3 documentation. What am I doing wrong?
TextInput::make('cardNumber')
    ->mask(RawJs::make(<<<JS
        $input.startsWith('34') || $input.startsWith('37') ? '9999 999999 99999' : '9999 9999 9999 9999'
    JS))
Solution
I've found my answer. The problem was a semicolon in the end of the JS.
TextInput::make('cost_price')
->prefix('€')
->mask(RawJs::make(<<<'JS'
     $money($input, ',', '.', 4)
JS
)),
Was this page helpful?