如何更改按钮的颜色html / javascript

时间:2016-01-06 00:28:42

标签: javascript html5

我无法更改按钮/选项的颜色(输入和更多信息)这里是我的代码的javascript部分:

 <script type="text/javascript">
     $(document).on('pagebeforeshow', '#index', function(){    
    // Add a new select element 


     $('<select>').attr({'name':'select-choice-1','id':'select-choice-1','data-native-menu':'false'}).appendTo('[data-role="content"]');
     $('<select>').attr({'name':'select-choice-2','id':'select-choice-2','data-native-menu':'false'}).appendTo('[data-role="content"]');

    $('<option>').html('More info').appendTo('#select-choice-2');
    $('<option>').html('Enter').appendTo('#select-choice-1');
    $('<option>').attr({'value':'1'}).html('Instructions').appendTo('#select-choice-2');
    $('<option>').attr({'value':'2'}).html('Bookings').appendTo('#select-choice-2'); 
    $('<option>').attr({'value':'3'}).html('Newsletter').appendTo('#select-choice-2');     
    // Enhance new select element
    $('select').selectmenu();

    $(document).on('change', '#select-choice-2', function(){    
        alert($(this).find("option:selected").text());


    });    

});

非常适合帮助。

0 个答案:

没有答案