jQuery是否仅适用于html页面?.... [英] does jquery works only with html pages?....

查看:88
本文介绍了jQuery是否仅适用于html页面?....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

jQuery是否仅适用于html页面?....我已经在asp.NET中的.aspx(webform)中创建了一些表单,但是jquery似乎并没有在那儿工作,但是按照它的逻辑可以在html页面中正常使用.

我认为问题是由于回发. HTMl不会回发,因此可以与that(jquery)正常工作,但是后者确实会回发,这可能是问题所在.

注意:我尝试返回"false",但也无法正常工作.
我对上述逻辑是正确的.如果我做错了,请提出建议.

谢谢&问候,
阿密特

好的.....这是我实际上要说的意思..........在html和aspx页面中都尝试.....

hey all,

does jquery works only with html pages??....I''ve created some forms in .aspx(webform) in asp.NET, but jquery does''nt seems to be working there, but as per the logic it works fine in html pages.

I think the issue is because of postback. HTMl doesn''t post back so it works fine with that(jquery), but the later does post back and that can be the issue.

NOTE: I have tried return "false" but that also not working.
Am i right about above logic. If i doing something wrong, please suggest.

Thanks & Regards,
Amit.

ok.....here''s what i actually mean to say.........try this in both html and aspx page.....

// When the <input>'s value changes
$("input").change(function() {
    // If the value is less than 7, add a red border
    if ($(this).val() < 7) {
        $(this).css("border", "5px solid red");
    }
    // Else if the value is equal to 7, add a green border
    else if ($(this).val() == 7) {
        $(this).css("border", "5px solid green");
    }
    // Else if the value is greater than 7, add an orange border
    else if ($(this).val() > 7) {
        $(this).css("border", "5px solid orange");
    }
    // Else if the value is anything else, add a black border
    else {
        $(this).css("border", "5px solid black");
    }
});



即使我在每个函数的末尾添加return false,它也不能在aspx中工作. 我是否缺少某些强制性的东西?……还是什么?…….



its not workin in aspx..........even if i add return false at the end of each function.
Is there something mandatory that i am missing........or what??....

推荐答案

(& quot; input& quot; ).change(function(){ // 如果该值小于7,则添加红色边框 如果(
("input").change(function() { // If the value is less than 7, add a red border if (


( this ).val()& lt; 7 ){
(this).val() < 7) {


( this ).css( &"border&",&"5px纯红色& amp;"); } // 否则,如果该值等于7,则添加绿色边框 其他 如果(
(this).css("border", "5px solid red"); } // Else if the value is equal to 7, add a green border else if (


这篇关于jQuery是否仅适用于html页面?....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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