Code Monkey home page Code Monkey logo

Comments (6)

chris-dickson avatar chris-dickson commented on June 12, 2024 2

Came up on an issue when trying to support this (specifically for autocomplete) in our app.

We have a form that contains multiple input fields, which are associated with their own datalist. When trying to bind the input list attribute to the datalist id, we receive the following error:

ERROR [app-router] TypeError: Cannot assign to read only property 'list' of object '#<HTMLInputElement>'(…)

My question is, how do we support having multiple datalists in the same document if we cannot dynamically assign unique list values for each input element?

from binding.

flieks avatar flieks commented on June 12, 2024

Could use this for creating your my own autocomplete custom element.. :)

from binding.

EisenbergEffect avatar EisenbergEffect commented on June 12, 2024

@jdanyow Do we need to do anything for this?

from binding.

jdanyow avatar jdanyow commented on June 12, 2024

I think the original question was around using an input combined with a datalist to in a <select> element like fashion in that the input's value binding would handle objects like we do in the select. This would be a good candidate to explore in an external plugin and then perhaps merge into the core if a good solution is found.

from binding.

jdanyow avatar jdanyow commented on June 12, 2024

Apparently the input element's list property is read-only... strange it's not documented as such:

image
https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement

You'll need to set the list HTML attribute (eg setAttribute('list', myId)) instead of attempting to assign the input element's list DOM property.

Here's an example that uses a binding behavior to make it easier:

https://gist.run/?id=40fbbb1ba7c43b1df5f078f0093c11e3

from binding.

chris-dickson avatar chris-dickson commented on June 12, 2024

Worked like a charm! Thanks Jeremy.

from binding.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.