facebook

List Item Font Color

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #346648 Reply

    Code_A
    Member

    I am dynamically building my list and I want to be able to change the font color of the text through code. I cannot seem to get it to work. Here is my code snippet:

    ...
    clone.attr('data-val', itmID);
    clone.find('label').text(itmValue);
    $select.append("<option value='" + itmValue + "'><font color='red'>"+ itmValue  +"</font></option>");
    ...

    Have also tried:

    $select.append("<option style='color: red' value='" + itmValue + "'><font color='red'>"+ itmValue  +"</font></option>");

    Is there a color attribute I need to use instead?

    #346718 Reply

    Hi Code A,

    Use next snippet to achieve it. I’ve highlighted the important parameters that need to be changed:

    $(‘<style>’
    + ‘#m1-sl-filling-list1 li > label { color: #f00; }’
    + ‘</style>’).appendTo(‘head’);

    #346733 Reply

    Unknown Author
    Participant

    Straight HTML works too. Here’s a code snippet from the “My Comic Books” app (available on iTunes). Remember that you need the double quotes if using the <font> tag.

    
       list.append(
         '<li id="m1-page_name-listItem1" class="' + cssClassList + '"' +
         '      data-action-click-id="action135" data-listitem-index="' + i + '">'+
         '   <div id="m1-page_name-listItem1-inner-div">'+
         '      <img id="m1-page_name-accessoryImage1" class="m1-clickable" '+
         '         src="res/images/tableRowDisclosureIndicator.png"/>'+
         '       <div id="m1-page_name-text2" class="m1-text"><font size=2.9 color="#000000">' + key +'</font></div>'+
         '   </div>'+
         '</li>');
    

    -1TC

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: List Item Font Color

You must be logged in to post in the forum log in