我正在尝试使用jquery隐藏和显示文本框。但是当我从c#solution explorer脚本文件夹中选择ajax库时,我没有获得预期的输出,但是当我使用CDN库时,它可以工作。如何设置此库以获得预期的输出?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="~/Default.aspx.cs"
Inherits="WebApplication1._Default" %>
<!DOCTYPE html>
<html>
<head>
<%--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>--%>//it works fine
<script src="Scripts/jquery-1.4.1-vsdoc.js"></script>//not works
<script src="Scripts/jquery-1.4.1.js"></script>//not works
<script src="Scripts/jquery-1.4.1.min.js"></script>//not works
<script>
$(function () {
$('input[name="type"]').on('click', function () {
var name, comp;
if ($(this).val() == 'Experienced') {
$('#txtname').show();
$('#txtcomp').show();
$('#Label1').show();
$('#Label2').show();
}
else {
$('#txtname').hide();
$('#txtcomp').hide();
$('#Label1').hide();
$('#Label2').hide();
}
});
});
</script>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 132px;
}
</style>
</head>
答案 0 :(得分:0)
我自己找到了我的问题的答案。如果将来任何人都面临这种类型的错误他们可以使用这种方法。我为解决这个问题做了什么我下载了Microsoft jquery库。这是链接
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7-vsdoc.js
现在在解决方案探索中添加3个新的jquery项,并命名为jquery-1.7.js,jquery-1.7.min.js和jquery-1.7-vsdoc.js.Now在新选项卡中打开上面的链接并复制整个内容并根据jquery文件夹名称保存。之后将此库添加到项目中
<head>
<script src="jquery-1.7-vsdoc.js"></script>
<script src="jquery-1.7.js"</script>
<script src="jquery-1.7.min.js"></script>
</head>
谢谢。一切顺利:)