Search code examples
javascriptjqueryinternet-explorer-8fqdn

JQuery / Javascript error in IE8 when using fully qualified domain name


This is incredibly strange and I can't figure it out. When using https://localhost/program/admin/menu.php I have no errors. But when I use the FQDN (https://FQDN/program/admin/menu.php), I get a javascript error. Here's the function that is failing:

$("#user-select").change(function() {
         var value1 = $(this + "option:selected").html();
    var attrs1 = value1.split("     ");
         applyValues(attrs1[0],attrs1[1],attrs1[2]);
    $("input[name=new-credential]").each(function(){
        $(this).val('');
    });
    $( "#add-credential-form" ).dialog( "open" );return false;});

The JQuery function fails because the variable value1 is null. It is not getting the selected option text and I'm not sure why it would work when using localhost as opposed to the FQDN in the URL.

Basically, when the select box changes, the add-credential-form dialog is populated with the selected option's text and the dialog is openned. I have no problems in other browsers. Just IE8 when using the FQDN. If it matters, I'm using JQuery 1.6.2 and JQuery UI 1.8.15. I appreciate your help on this matter. Let me know if you need any more information.

Thank You!


Solution

  • Try changing

    var value1 = $(this + "option:selected").html();
    

    to

    var value1 = $(this).find("option:selected").html();
    

    If this works, I don't know why it would work locally but not remote, though.