Link to home
Start Free TrialLog in
Avatar of WorknHardr
WorknHardr

asked on

MVC View Color Negative Number Red?

I have a MVC View and html table containing some negative numbers, formatted with leading ( and trailing ) respectfully.

  ($8.00)

Q. Anyway to place a minus instead fo brackets?
Q. Is Jquery the best way to go?
Q. How do I get the neg nums red?

I have found this JQuery snippet which doesn't work
<td><span id="diff">@group.Diff.ToString("c")</span></td>

<script type="text/javascript">
    $("span:contains('(')").css("red", "#diff");
</script>

Open in new window

Avatar of Gary
Gary
Flag of Ireland image

$("span:contains('(')").css("color", "red");

Open in new window

As for the brackets - it would be easier to do this at runtime.  Why/how are you getting the brackets to start with?
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WorknHardr
WorknHardr

ASKER

thx