简体   繁体   中英

javaScript issue in IE but not Firefox

I have an MVC3 C# .Net web app. I am firing a javaScript method of a submit button on the onclick event. It works just fine in Firefox, I see the confirm box, but not in IE 8. In IE it is always returning true and not showing the confrim box. Here is the javascript:

<script type="text/javascript">

    function DoCopy() {
      return confirm(($("#myField").val().contains(";" + $("#myOtherField").val() + ";")));
    }
</script>

Here is the button:

<input type="submit" id="thePageSubmit" name="Command" value="Save" onclick="return DoCopy();" /> 

I am using jQuery but even when I use straight javaScript (document.forms[0].elements["myField"]) it works in Firefox but not IE. Any ideas?

I found the answer at this link: It's not compatible in IE string.contains

兼容性

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM