I have some part numbers as a string.For example :
partnumber = "a1;a2;a3"
Now I am displaying it using text() function like
$("#id").text("Part number(s) " + partnumber+ " is shown");
But I want to change the color of partnumber only and not the full text.
So I should get something like this :
Part number(s) (some color) a1;a2;a3 (some color) is shown.
How to do this using jquery?
You have to wrap it in a span and use a class to define the extra styling:
You have to use
html()instead oftext()because you are inserting html not plain text.