locked
HTML Client - Can CSS be applied to Display Name (Label)? RRS feed

  • Question

  • Hi All,

    Is it possible to easily apply CSS to the Display Name of a control? For example the following line in the postRender for the control only affects the value and not the Display Name.

    $(element).css("padding-left", "100px");

    This is HTML Client VS2012 - Update 2.

    Many thanks

    Ash


    • Edited by sentin3l Wednesday, June 5, 2013 1:42 AM
    Wednesday, June 5, 2013 1:36 AM

Answers

  • Yes.  You could do it in a couple of ways.

    1.  Wing it.

    $(element).parent().css('color','red'); or

    $(element).parent().parent().css('color','red'); or

    $(element).parent().parent().parent().css('color','red'); etc. until you get the effect you want, or

    2. Use Firefox's Firebug to inspect the element tag you want to change, then use either jQuery .parents() or  .closest() with this selector to change the CSS.

    • Marked as answer by sentin3l Wednesday, June 5, 2013 3:27 AM
    Wednesday, June 5, 2013 3:07 AM

All replies

  • Yes.  You could do it in a couple of ways.

    1.  Wing it.

    $(element).parent().css('color','red'); or

    $(element).parent().parent().css('color','red'); or

    $(element).parent().parent().parent().css('color','red'); etc. until you get the effect you want, or

    2. Use Firefox's Firebug to inspect the element tag you want to change, then use either jQuery .parents() or  .closest() with this selector to change the CSS.

    • Marked as answer by sentin3l Wednesday, June 5, 2013 3:27 AM
    Wednesday, June 5, 2013 3:07 AM
  • Thanks very much.

    Ash

    Wednesday, June 5, 2013 3:28 AM
  • I am also facing the same problem. I gone through Rohit Agarwal’s article Spice Up Your HTML Client UI With Code. By Reading this article we are able to append some text near about the display name of the application. But I have a problem that how we can apply the css on display name?

    Finally After some practice I found the solution of this problem with the help of Spice Up Your HTML Client UI With Code article. Here is the solution step by step.

    add the following code under row template post render part.

    $(element).closest ("[data-role='page']").find (".id-element").css ('color', 'red');

    For more detailed explanation please refer following link.

    http://harshgupta71.blogspot.in/2014/03/how-to-apply-css-on-display-name-or.html

    Sunday, March 16, 2014 6:24 PM