-1

I have been trying to change certain part of text to bold and red color.

It's not working on Microsoft Edge.

My code:

alert("Hi how are you my friend");

Need to make text : "friend" as bold and red color

I tried this but does not work

alert("Hi how are you my <b> <background-color = red"> friend </b>);

Any solution is much appreciated

kiric8494
  • 195
  • 1
  • 7
  • @Tom : No tom without any package installation I want it – kiric8494 Jun 03 '22 at 14:24
  • 1
    I don't think it is possible using `alert()`. You either have to create your own alert with html and css or use a library. – Samball Jun 03 '22 at 14:31
  • 1
    `window.alert()` only allows strings of text, not styled content. See [alert documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/alert). Creating a message box with HTML/CSS does not need a package if you style it yourself - but you will have to code a little. – Peter Krebs Jun 03 '22 at 14:42

2 Answers2

0

It is impossible i searched for this problem a lot, but you can make your window ,it isn't hard to find tutorials.

e.g https://www.delftstack.com/howto/javascript/javascript-customize-alert-box/

0

Unless you use the dialog tag in jQuery to create the alert,it somehow has been styled in the jQuery theme already.... Styling JavaScript alert box on my end here I don't think it's possible