Giter Club home page Giter Club logo

Comments (8)

kflorence avatar kflorence commented on August 22, 2024 1

@EnricoU i think the use case here is that calling deserialize on the form will potentially not properly set multiple select list values if there are existing values on the element -- basically after deserialization the form values would be in an invalid state because they don't match what was serialized.

from jquery-deserialize.

kflorence avatar kflorence commented on August 22, 2024

@dshiryaev-plesk hmm, why hardcode selected="selected" if you don't want it?

from jquery-deserialize.

kflorence avatar kflorence commented on August 22, 2024

But it does seem like a bug, so I will look at it soon.

from jquery-deserialize.

dshiryaev-plesk avatar dshiryaev-plesk commented on August 22, 2024

It's just for the example. If you delete selected="selected", then select the options manually, then run javascript code, you will get the same result.

@dshiryaev-plesk hmm, why hardcode selected="selected" if you don't want it?

from jquery-deserialize.

kflorence avatar kflorence commented on August 22, 2024

@dshiryaev-plesk please try out https://github.com/kflorence/jquery-deserialize/releases/tag/2.0.0-rc1

from jquery-deserialize.

enrico-usai avatar enrico-usai commented on August 22, 2024

I think there is no need to update the selected attribute programmatically as the browser will automatically know which element is selected. The selected attribute is intended to set a default option on page load.

From: https://www.w3schools.com/tags/att_option_selected.asp

"When present, it specifies that an option should be pre-selected when the page loads."

A pre-selected option seems "selected", but the $('#selectid option:selected').val() command just returns the new value set by the deserialization function.

from jquery-deserialize.

dshiryaev-plesk avatar dshiryaev-plesk commented on August 22, 2024

@kflorence, exactly.

from jquery-deserialize.

kflorence avatar kflorence commented on August 22, 2024

Closing, as this should have been addressed with #39.

from jquery-deserialize.

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.