-5
$().ready(function() {
    $("#textfield2").autocomplete("location.php", {
        width: 200,
        matchContains: true,
        //mustMatch: true,
        //minChars: 0,
        //multiple: true,
        //highlight: false,
        //multipleSeparator: ",",
        selectFirst: false
    });
});

   jQuery(function(){

                jQuery("#textfield4").validate({
                    expression: "if (VAL) return true; else return false;",
                    message: "Please enter the Required field"
                });
                                jQuery("#textfield5").validate({
                    expression: "if (VAL.length > 5 && VAL) return true; else return false;",
                    message: "Please enter a valid Password"
                });
                jQuery("#textfield6").validate({
                    expression: "if ((VAL == jQuery('#textfield5').val()) && VAL) return true; else return false;",
                    message: "password field doesn't match "
                });
                jQuery("#textfield7").validate({
                    expression: "if (VAL) return true; else return false;",
                    message: "Please enter the Required field"
                });
                jQuery("#textfield8").validate({
                    expression: "if (VAL) return true; else return false;",
                    message: "Please enter the Required field"
                });
                jQuery("#state1").validate({
                    expression: "if (VAL != '') return true; else return false;",
                    message: "Please make a selection"
                });
                jQuery("#select4").validate({
                    expression: "if (VAL != '') return true; else return false;",
                    message: "Please make a selection"
                });
                jQuery("#textfield9").validate({
                     expression: "if (VAL.match(/^[9][0-9]{9}$/)) return true; else return false;",
                     message: "Please enter a valid number"
                });  
                jQuery("#exp1").validate({
                    expression: "if (VAL != '') return true; else return false;",
                    message: "Please Select Experience"
                });
                jQuery("#jobarea").validate({
                    expression: "if (VAL != '') return true; else return false;",
                    message: "Please Select Functional Area"
                });
                jQuery("#skill").validate({
                    expression: "if (VAL != '') return true; else return false;",
                    message: "Please Enter Skills"
                });
                jQuery("#edu").validate({
                    expression: "if (VAL != '') return true; else return false;",
                    message: "Please select Education"
                });
                jQuery("#textfield10").validate({
                    expression: "if (VAL) return true; else return false;",
                    message: "Please Enter Resume Heading"
                });
});
4

1 回答 1

1

使用以下代码解决冲突:

var jQ = jQuery.conflict();

并使用实例 jQ 替换$jQuery

编辑:

在 JS 的顶部添加上述行后,使用类似的对象。:

jQ().ready(function() { //replace $ with jQ
    jQ("#textfield2").autocomplete("location.php", {
        width: 200,
        matchContains: true,
        selectFirst: false
    });
});
     jQ(function(){ //replace jQUery with jQ

            jQ("#textfield4").validate({
                expression: "if (VAL) return true; else return false;",
                message: "Please enter the Required field"
            });
      });

在这里,我将$andjQUery都替换为 our object jQ

于 2013-06-18T11:58:38.173 回答