Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#9753 closed bug (invalid)

Setting option value (containing space) using append

Reported by: madhurs99 Owned by:
Priority: low Milestone: 1.next
Component: manipulation Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

Appending new option using below code

var OptionDesc = "United Kingdom";
var OptionValue = "United Kingdom"
$('select').append("<Option value="+OptionValue+" >"+OptionDesc+"</Option>");

generates wrong HTML

<select>
<option value="United" kingdom="">United Kingdom</option>
</select>

Change History (3)

comment:1 Changed 8 years ago by madhurs99

Please find below the test case for the same

http://jsfiddle.net/madhurs99/y8Mbw/

comment:2 Changed 8 years ago by dmethvin

Resolution: invalid
Status: newclosed

The value attribute needs to be quoted if it contains spaces.

comment:3 Changed 8 years ago by timmywil

Component: unfiledmanipulation
Priority: undecidedlow
Note: See TracTickets for help on using tickets.