开发者

Option insertion problem in Internet Explorer 7

var spaces="----";  
var category_name="category";
    var category_text=spaces+category_name;
    alert(category_text);
    $('select').append($("<option>").attr({'value' : inserted_id , 'label' : category_name}).text(category_text));

This code includes option to my listbox.

The problem in Internet Explorer 7. The option is included, but the expected display is '----category'. But Internet Explorer 7 displays only category in options. Since I am using tree order I need to have hyphens before so开发者_如何学Gome category. How can I solve it in Internet Explorer 7?


Try this:

$('select')
    .append($("<option />")
        .attr({'value' : inserted_id , 
               'label' : category_name, 
               'text' : category_text
             }));

or this:

$('select')
    .append($("<option />")
        .attr({'value' : inserted_id , 
               'label' : category_text 
             }));


You set label to category_name. It seems like if you set the lable it displays this instead of the inner HTML.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜