简体   繁体   中英

jQuery Mobile Changing Text Colour at Runtime

I'm trying to change the text colour on a JQueryMobile button at runtime. I've been through many answers and tried a variety of items but it's not working for me. :(

It's the text colour of btnAnswer1 that I want to change the colour of.

I've tried the following, all with no luck.

$("#btnAnswer1").html('<color=green>Hello</color>');

$("#btnAnswer1").html(Hello);


$("#btnAnswer1").val("new text for button");


$('#btnAnswer1').children('.ui-btn').children('.ui-btn-c').children('.ui-shadow').children('.ui-corner-all').text("HELLO");


$('#btnAnswer1').val('Mark New');
$('#btnAnswer1').button('refresh');

Layout:

在此处输入图片说明

Use the .css() function of jQUery ( docs ).

Something like the following will work: $('#btnAnswer1').css('color', 'green') .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM