1

以下のスクリプトを追加すると、プロジェクトの他の機能に影響します(Spring Application)

  <script type="text/javascript" src="${ctx}/js/jquery-1.3.2.min.js"></script>

マイコード

    <script type="text/javascript" src="${ctx}/js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="${ctx}/js/easy.notification.js"></script>
    <script type="text/javascript">

    $.noConflict();

    $(function() {
            $("input[type='text']").blur(function() {

                if (this.value === '') {
                    $.easyNotificationEmpty('Warning : You left this field empty !');
                } else {
                    $.easyNotification('Saved Successfully !');
                }
            })
        });
</script>

私はそれがjquery-1.3.2.min.js

を試し$.noConflict();ましたが、望ましい結果が得られません。

この問題の解決にご協力ください。よろしくお願いします。

4

5 に答える 5

8

これを試して、

jQuery(function($) {
    $("input[type='text']").blur(function() {

        if (this.value === '') {
            $.easyNotificationEmpty('Warning : You left this field empty !');
        } else {
            $.easyNotification('Saved Successfully !');
        }
    })
});
于 2013-06-13T12:31:53.450 に答える
3

$.noConflict();を使用します。以下のような新しい jquery プラグインを含める前に、

//your old plugin here

<script type="text/javascript">

$.noConflict();

</script>

// new plugin here 

//new script here
于 2013-06-13T12:41:54.260 に答える
2

jQuery.noConflict他のスクリプトが壊れる原因となるスクリプトで使用するエイリアスに実装してみてください。

var someAlias = $.noConflict();

また、問題の原因となっているスクリプトでは$の代わりにsomeAliasを使用してください。

于 2013-06-13T12:36:49.570 に答える
1

それをテストして、これが違いを生むかどうかを確認できます。

(function ($) {
    $(function() {
            $("input[type='text']").blur(function() {

                if (this.value === '') {
                    $.easyNotificationEmpty('Warning : You left this field empty !');
                } else {
                    $.easyNotification('Saved Successfully !');
                }
            })
        });
})(jQuery.noConflict(true))

例えば:

http://jsfiddle.net/6zXXJ/

于 2013-06-13T12:37:24.550 に答える
0

私は TRUE と一緒に使用します... この作品!:

//your old plugin here


<script type="text/javascript">

$.noConflict(true);

</script>

// new plugin here 
于 2014-06-15T02:29:14.287 に答える