Comments (2)
Thanks for this great tutorial. Enjoy reading it!
Glad it's helping you.
delete the line of H.getHTMLELEMENTRef [and I] still get the same behaviour. maybe log the element's text to show the element is the 'my-button' element?
The fact that the same behavior occurs despite deleting that line does not surprise me at all. However, do you understand why it works that way?
I tried to get the text out of the button element, but seems not as easy as I thought.
Looks like there isn't a function innerText :: HTMLElement -> Effect String
in purescript-web-html. If there was, you could then write:
handleAction :: HandleSimpleAction State Action
handleAction = case _ of
PrintExample -> do
-- Here, we use this reference to do something with the element
H.getHTMLElementRef (H.RefLabel "my-button") >>= traverse_ \element -> do
-- in this situation, we'll just state that the element exists
-- and could be used here
-- todo: get infor from element
liftEffect do
innerTxt <- innerText element
log innerTxt
One way to get around that limitation is to write the FFI for that function here.
from learn-halogen.
text <- textContent $ toNode element
works. thanks.
from learn-halogen.
Related Issues (20)
- `--no-minify` is not supported by `serve` action of `parcel` HOT 4
- Link to 'Styling Question' and its links
- Update project to 0.13.4 PS release
- Upgrade project to PS 0.13.5
- Upgrade project to Spago 0.12.1
- Add CI build for local-based installation
- Whatβs best practice/pattern for cross component communication HOT 1
- Add tip from Gary for rendering valid/invalid input data
- Add exercises for each example HOT 7
- launchAff_ vs runHalogenAff HOT 2
- Const Void or Const Unit for unused Query HOT 8
- Link to 'template repo' for Halogen
- Recommend spago's --watch feature in automatic reload instructions HOT 6
- Integrate examples with `halogen-storybook`
- Change `purescript-jordans-reference` links to use its `latestRelease` branch? HOT 6
- Which to cover first? Halogen Hooks or Halogen Components? HOT 9
- use forall instead of Void for empty queries, messages, inputs HOT 1
- Link to statebox's fork of halogen-svg
- Feature Request: convert to mdBook HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learn-halogen.