Git Product home page Git Product logo

Comments (8)

vestman avatar vestman commented on August 28, 2024

Could you give me an example?

Edit: Thanks, I'm glad you like it!

from select-or-die.

PawelGIX avatar PawelGIX commented on August 28, 2024

SOD don't display selected option on page load if there is placeholder configured. Maybe you should add empty option on beginning of select input in this scenario (but not displayed in sod) - this reflects first empty state.

from select-or-die.

vestman avatar vestman commented on August 28, 2024

Well, @welly, it only took me 3 months. But after reading the comment from @PawelGIX I added a second placeholder option that will use the first <option> in the select as the placeholder. Don't know if this is what you're looking for, @welly.

from select-or-die.

bryannielsen avatar bryannielsen commented on August 28, 2024

I think I'm seeing this issue too, if you have a placeholder set (I'm using data-placeholder) and you load a element that already has a "selected" option, the placeholder is displayed instead of the selected option's value. I'm looking to see if I can figure out a workaround right now.

from select-or-die.

vestman avatar vestman commented on August 28, 2024

@bryannielsen Thanks for the input. The thing is that a native <select> always have a "selected" <option>, even if the user haven't made a selection or there's not an <option selected> specified. I guess the first sentence - "If you feel like adding a placeholder that's displayed before anything is selected" - in the description of the placeholder alt.1 is a bit misleading.

As I wrote in the comment above I added a second placeholder setting that fixes this issue. But then you need to prepend your <select>with an <option> that should be used as the placeholder.

In this fiddle you'll see an example of how both settings works. The third one is using the placeholder alt.1 setting and if you fire up the console you'll see that the first option is the one selected.

from select-or-die.

vestman avatar vestman commented on August 28, 2024

I'm closing this issue for now. Feel free to re-open if you don't feel that the second placeholder setting does the trick.

from select-or-die.

bryannielsen avatar bryannielsen commented on August 28, 2024

@vestman thanks! This looks perfect. Sorry I read the description for the new placeholder option but it wasn't clear to me that it would fix this issue. Looking at your fiddle and your description above I think this should solve the problem.

Thanks for the quick response and the awesome plugin!

from select-or-die.

vestman avatar vestman commented on August 28, 2024

No problem, @bryannielsen, just let me know if you have any other questions. I'm glad you like the plugin!

from select-or-die.

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.