how do I redirect a page by clicking on an option from a select by google chrome?

3

I am using this jquery already tried to use the change also but it does not execute

<script>
$(document).ready(function(){
    $("#select-native-fc").on('click', function(){
            if($("#select-native-fc").val() == "ASM2")
            {
                alert('Teste');
            }
});
</script>

Select code:

<div class="ui-field-contain">  
    <label for="select-native-fc">Linhas de Assembly:</label>
    <select name="select-native-fc" id="select-native-fc" class="assy">
        <option value="http://www.youtube.com">Assembly 1</option>
        <option value="ASM2">Assembly 2</option>        
        <option value="ASM3">Assembly 3</option>
        <option value="ASM4">Assembly 4</option>
        <option value="ASM5">Assembly 5</option>
        <option value="ASM6">Assembly 6</option>
        <option value="ASM7">Assembly 7</option>
        <option value="ASM8">Assembly 8</option>
        <option value="ASM9">Assembly 9</option>
        <option value="ASM10">Assembly 10</option>
        <option value="ASMX">Assembly X</option>
        <option value="ASMY">Assembly Y</option>
        <option value="ASMZ">Assembly Z</option>

    </select>
</div>

I needed to click on some option redirects to another page I am using jquery for mobile the events only works for IE however in google chrome it does not work and neither for the mobile platform I am using these libraries of jquery below:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script><scriptsrc="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    
asked by anonymous 24.06.2016 / 15:17

2 answers

3

Problem was that the ready was not closed, code corrected:

$(document).ready(function(){
    $("#select-native-fc").on('click', function(){
            if($("#select-native-fc").val() == "ASM2")
            {
                alert('Teste');
            }
    });
});

    
24.06.2016 / 16:05
2

Hmm .. Almost sure code is missing close}) and use prevent $("#select-native-fc").trigger("click");

$(document).ready(function(){
    $("#select-native-fc").on('click', function(){
      if($("#select-native-fc").val() == "ASM2") {
        alert('Teste');
      }
    });
    $("#select-native-fc").trigger("click");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><linkhref="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet"/>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script><divclass="ui-field-contain">  
    <label for="select-native-fc">Linhas de Assembly:</label>
    <select name="select-native-fc" id="select-native-fc" class="assy">
        <option value="http://www.youtube.com">Assembly 1</option>
        <option value="ASM2">Assembly 2</option>        
        <option value="ASM3">Assembly 3</option>
        <option value="ASM4">Assembly 4</option>
        <option value="ASM5">Assembly 5</option>
        <option value="ASM6">Assembly 6</option>
        <option value="ASM7">Assembly 7</option>
        <option value="ASM8">Assembly 8</option>
        <option value="ASM9">Assembly 9</option>
        <option value="ASM10">Assembly 10</option>
        <option value="ASMX">Assembly X</option>
        <option value="ASMY">Assembly Y</option>
        <option value="ASMZ">Assembly Z</option>
    </select>
</div>

Here it turned beautiful and someone did not run, I can modify different more specific code of haddle.

    
24.06.2016 / 21:23