0

次のコードで、tapおよびtap holdイベントを認識するために、jquerymobilejavascriptファイルをコードに含めた場合

$("#applyZoom").live("tap", function(event){
    alert('binding');
});

Chromeブラウザで「OriginnullはAccess-Control-Allow-Originで許可されていません。」というエラーが表示されます。
IOSシミュレータでテストしたところ、他のクリックイベントは機能していません。
私はajax呼び出しを使用していません。

このエラーを取り除くために私を助けてください。

4

1 に答える 1

0

What is the jQuery library are you using? live is depreciated as of 1.9. You should use on instead of live. Check whether it solves the issue.

As per the documentation you should do something as below

$( "#applyZoom" ).on( 'tap', tapHandler );
function tapHandler( event ) {
    alert("all set");
}

I suppose you are trying to run the files from local directory, instead of a hosted solution. Try to host it in localhost and access via http and see whether you get null origin error. Else try to access via file:/// like url and see.

于 2013-03-20T12:12:30.957 に答える