JQuery Lipsum生成器不生成单词

时间:2014-01-30 06:03:52

标签: javascript jquery html5

有一个名为lipsum.com的网站可以生成随机文本。我试图使用jquery生成一个单词并将其保存到变量。我找到了这个[1]:http://sanderkorvemaker.nl/jquery/jLorem.php这可能真的很好,但我不确定为什么它不起作用。根据我提出的解决方案示例,我在我的解决方案中将javascript文件放在名为“Script”的文件夹中,但我仍然没有得到任何输出到屏幕。

这是我的代码:

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"</script>
    <script src="Script/jquery.lorem.js" type="text/javascript"></script>
    <script type="text/javascript">
            $(document).ready(function () {
                $('.ipsum').lorem({ type: 'paragraphs', amount: '4', ptags: true });
            });
    </script>
</head>
<body>
<div class="ipsum"></div>
</body>
</html>

1 个答案:

答案 0 :(得分:2)

添加一个类为“ipsum”的div。

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="Script/jquery.lorem.js" type="text/javascript"></script>
    <script type="text/javascript">
            $(document).ready(function () {
                $('.ipsum').lorem({ type: 'paragraphs', amount: '4', ptags: true });
            });
    </script>
</head>
<body>
     <div class="ipsum"></div>
</body>
</html>
相关问题