[Solved] jQuery bug in .append with ternary `:?` operators?


It’s not the ternary that’s the issue, it appears to be how jQuery/HTML is handling the empty string. jQuery is most likely not resolving the property to an explicit false and thus creating an element with a "selected=''" which the browser may just be interpreting as "selected" which I believe is from an old HTML standard that recognized that as being selected. If you make the false explicit it will work:

selected: (this.Abbreviation === csc.statesDDL.txt().val() ? 'selected' : false)

1

solved jQuery bug in .append with ternary `:?` operators?