PricingBlog

Get element by id

  • mdxwired-1273642527626629172

    mdxwired

    1 year ago

    So, trying to use the in-built Get ----> Get element by id functionality (not a custom-written JavaScript function) to return the available paths for a main div from which I hope to extract the current scroll state. The intent is to change the opacity of my persistent 'sticky' header div whenever the underlying main div contents scroll behind it. Can't seem to get Get element by id (in formula) to return anything. I am sure that I am just doing it wrong. Thoughts?
    1273642528096256081-image.png
  • tomthebigtree-1273648391683047514

    Tom Ireland

    1 year ago

    One trick I learned a while back is to use 'On load' and set an empty variable. Use 'Set' with an empty array as the object and 'Get element by ID' as the value (key doesn't matter). Then, in the same action, log to console the value of the variable and you should see all paths. You should then be able to use 'Get' with 'Get element by ID' as the object and the path you need as the path e.g. innerHTML, etc. I had to do something like this when I was working on th toddle RTE last year.
    👍1
  • tomthebigtree-1273649179050377297

    Tom Ireland

    1 year ago

    Iirc, I used it to get the offsets for positioning a component above text when making a selection. Was a while back.
  • mdxwired-1273680361775435867

    mdxwired

    1 year ago

    Thanks! I tried it. Sadly, it does not actually seem to contain the info I need to pull off my trick. I think I will need to load up some custom Javascript for this to work. I'm going to de-prioritize this one to "nice to have" and get on with the rest of the alpha build. 😕
  • tomthebigtree-1273680677501403177

    Tom Ireland

    1 year ago

    That's a shame. 😕 Not sure what else to advise in my experience. Hoping someone else might chime in.
  • mdxwired-1273681003751411763

    mdxwired

    1 year ago

    Hey... this is really 'low code' dev and I appreciate it for what it is! 😀
    🙌1