jQuery 如何使用此字符串显示项目符号?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9145684/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 10:24:18  来源:igfitidea点击:

How to display a bullet point with this string?

jquery

提问by user1182476

How do I display this string with a bullet point?

如何使用项目符号显示此字符串?

Below is the string:

下面是字符串:

if (!this.value || this.value.length < 5) {
    alertValidation += "\nYou have not entered a valid Question\n";
}

回答by ori

If you want to alert()it, do:

如果您愿意alert(),请执行以下操作:

 alertValidation += "\n\u2022 You have not entered a valid Question\n";

回答by Zeyad Quness

alert ('\u2022 A, \n\u2022 B, \n\u2022 C, \n\u2022 D');

回答by live-love

You should enclose your strings in a resource file, strings.xml, for translation purposes. Here is how to use the bullet character in a resource file:

您应该将字符串包含在资源文件 strings.xml 中,以便进行翻译。以下是在资源文件中使用项目符号的方法:

<string name="alert_validation">\n\u2022 You have not entered a valid Question\n</string>

alertValidation = getString(R.string.alert_validation);