SSP
SSP

Reputation: 2670

how to format text in java script in rails apps

I have a with id this is logic so here i am sending text dynamically now i want to resize and recolour this text. my jquery look like this

<script type="text/javascript">
 $(function($){
 $("#daily_type").change(function()
{
  logic = $(this).val()

  LogicShow(logic)
})
function LogicShow(logic)
{

  if ( logic == "iss" )
  {
    var spanText = "Based on the severity High" ;
    $("#logic_change").html(spanText);
  }
  if ( logic == "unix" )
  {
    var spanText = "Summary reflects based on the number of events.Such as how many times number of events observed" ;
    $("#logic_change").html(spanText);
  }

}
});

</script>

so now how can i pass text with some good text format and colour.

Upvotes: 0

Views: 149

Answers (1)

thecodeparadox
thecodeparadox

Reputation: 87073

Giving a class with a span wrapping.

var spanText = '<span class="logictext">Based on the severity High</span>' ;

And then wrote css for those classes.

Or you can give inline css as well:

var spanText = '<span style="color: #f00;">Based on the severity High</span>' ;

Upvotes: 1

Related Questions