codeigniter没有阅读jquery [英] codeigniter not reading jquery

查看:146
本文介绍了codeigniter没有阅读jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的codeigniter应用程序中包含jquery。为此,我在codeigniter文件夹中创建一个js文件夹,其中我放两个文件。 jquery.js与运行jquery的代码,其他文件,duplicate.js其中我有以下代码来看看页面是否正在运行jquery。

I'm trying to incorporate jquery in my codeigniter application. To do so, i created inside the codeigniter folder a js folder, where i put two files. The jquery.js with the code to run the jquery, and other file, duplicate.js where i have the following code to see if the page is running jquery.

     window.onload = function() {
    if (window.jQuery) {  
        // jQuery is loaded  
        alert("Yeahsssss!");
    } else {
        // jQuery is not loaded
        alert("Doesn't Work");
    }

}

然后,在headr模板我的意见我有:

Then, in the headr template of my views i have:

<html>
<head>
    <title></title>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <link rel="stylesheet" href="<?php echo base_url();?>css/mystyle.css" type="text/css" media="screen"/>
    <script type="text/javasript" src="<?=base_url()?>js/jquery.js"></script>
    <script type="text/javasript" src="<?=base_url()?>js/duplicate.js"></script>
</head>
<body>

这不应该足够在页面上运行jquery吗?我缺少某些内容?

Shouldn't this be enough to run jquery on the pages? Am i missing something?

编辑:

生成的头部分:

    <head>
    <title> - CodeIgniter 2 Tutorial</title>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <link rel="stylesheet" href="http://localhost/code/css/mystyle.css" type="text/css" media="screen"/>
    <script type="text/javasript" src="http://localhost/code/js/jquery.js"></script>
    <script type="text/javasript" src="http://localhost/code/js/duplicate.js"></script>
</head>


推荐答案

您有拼写错误: text / javasript 应为 text / javascript

c> type ,它是为脚本定义的,浏览器确定它是什么脚本以及如何处理它。所以如果这种类型不正确,浏览器将不会解释脚本的内容,如果它是一个内联脚本或加载其源如果它有一个 src 属性。

depending on the type that is defined for the script the browser determines what script it is and how to handle it. so if this type is not correct, the browser won't interpret the content of script if it is an inline script or load its source if it has a src attribute.

这篇关于codeigniter没有阅读jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆