R
R
Roman Yakovlev2011-07-29 15:56:13
Mootools
Roman Yakovlev, 2011-07-29 15:56:13

Mootools select(option) not working setting attribute selected='true'

var select = new Element('select');
select.grab(new Element('option', {value: 'usd', selected: 'yes', text: 'usd',}));
select.grab(new Element('option', {value: 'usd',text: 'eur'}));

$('someContainer').grab(select);

This is the code and the selected attribute is not set. It is not set even via setPrperty by id.
Although any other attributes are set just fine. Extremely strange behaviour.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anatoly, 2011-07-29
@taliban

I go to the site mootools.net , enter the code into the console:


var select = new Element('select');
 select.grab(new Element('option', {value: 'usd', text: 'usd',}));
 select.grab(new Element('option', {value: 'usd', selected: 'yes', text: 'eur'}));

 $('header').grab(select);

At the top left of the header, a select appears with two elements. Which one is highlighted, you ask me? Second, do you know why? Because mutuls gives it a selected attribute.
Opera 11.50

R
Roman Yakovlev, 2011-07-29
@feligz

jsfiddle.net/romanco/xpHRq/4/
yes, the select is processed, but I need the selected="true" attribute to be set, any other one is inserted, but this one is not...

A
Alexey, 2014-04-25
@alexgl2004

selected="true" does not exist in principle. According to the rules, it should be selected="selected"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question