質問

I have the following code which doesn't work in FireFox. Works in Chrome and IE with no error messages. The TEST alert doesn't even get fired in FF

Any suggestions? I've tried putting the JS to the top of the page but that doesn't work either.

<p class="hed" id="postcomment">save comments</p>


    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("p#postcomment").click(function () {
                alert("TEST");
                $.post(
                   "putComment.asp",
                   {
                       zR: "data1",
                       zP: "data2",
                       zN: "",
                       zF1: "data3",
                       zF2: "Provider_Shortname=ALL",
                       zF3: "FinMonth=2014-02-01",
                       zF4: "",
                       zC1: $('#comment1').val(),
                       zC2: $('#comment2').val(),
                       zC3: $('#comment3').val(),
                       zC4: $('#comment4').val()
                   },
                   function (data) {
                       alert("Data Loaded: " + data);
                   }

                );
            });
        });
    </script>
役に立ちましたか?

解決

there is something else going on , here is your HTML and your jquery working in jsFiddle , even in FireFox. The error is outside of the code that you pasted in your question

http://jsfiddle.net/DS8N4/

<p class="hed" id="postcomment">save comments</p>

他のヒント

Since id is unique, try to use:

$("#postcomment").click(function () {

instead of:

$("p#postcomment").click(function () {

Also, try to use http: or https: protocol here:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top