0

I have this strange problem, I never had before and it only occurs in Google Chrome browser. I have made a function to create a writebutton (that writes a value to my PLC true ajax). This is how it looks:

    function makeWriteButton(id, address, value, startRefresher){

            $("#" + id).click( function() {
                writeData(address, value, startRefresher);
            });
    }

So you pass the id of your input button to that function and the function adds a click event handler, this function works perfect in IE, Firefox, Safari, Opera, but not in Chrome.

Does anyone have any suggestions or reasons why this doesn't work? and by the way this function used to work before on chrome but I don't know what I did so it's doesn't work anymore in chrome, really weird.

4

1 回答 1

1

我不认为您的问题出在那段代码中,这在 Chromium 上对我有用

<button id="but1">Button1</button>
<button id="but2">Button2</button>
<button id="but3">Button3</button>
<button id="but4">Button4</button>
<button id="but5">Button5</button>

function makeWriteButton(id, address, value, startRefresher) {
    $("#" + id).click(function () {
        alert(address + " " + value + " " + startRefresher);
    });
}

makeWriteButton("but3", 5, 6, 7);

jsfiddle上

于 2013-04-23T15:22:00.180 回答