Skip to content

Cannot get custom Alpine directives working with npm modules #4424

Closed Answered by ekwoka
dotfrag asked this question in 1. Help
Discussion options

You must be logged in to vote

Your code is

Alpine.directive("uppercase", (el) => {
  el.textContent.toUpperCase();
});

But the correct code is

Alpine.directive("uppercase", (el) => {
  el.textContent = el.textContent.toUpperCase();
});

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@dotfrag
Comment options

@ekwoka
Comment options

@dotfrag
Comment options

@ekwoka
Comment options

Answer selected by dotfrag
@dotfrag
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants