-1

What is wrong here, index.php

<div id="divM"></div>
<script src="jquery-1.9.1.min.js"></script>
<script src="index.js"></script>

index.js

$("#select01").change(function(){
    var a = $(this).val() + ".php";
    $("#divM").load(a);
});

So, a page is loaded inside divM and select03 is inside the loaded page.

index.js

$("#select03").on("change", function(){
    alert ("323"); // nothing happens here !
});
qadenza
  • 9,025
  • 18
  • 73
  • 126

4 Answers4

1
Try this
$(document.body).on("change","#select03", function(){
    alert ("323"); // nothing happens here !
});
$("#select01").change(function(){
var a = $("#select01 option:selected").val() + ".php";
$("#divM").load(a);
}); 
Muhammad Atif
  • 1,050
  • 1
  • 9
  • 21
1

Use event-delegation

$("#divM").on("change", "#select03", function(){
    alert ("323"); // nothing happens here !
});
Oleksandr T.
  • 76,493
  • 17
  • 173
  • 144
1

Change your function to:

$(document).on("change", "#select03", function(){
    alert ("323"); // nothing happens here !
});
GreyRoofPigeon
  • 17,833
  • 4
  • 36
  • 59
1

Try below code:

$(document).on("change", "#select03", function(){
    alert ("abc"); // nothing happens here !
});
Light
  • 1,077
  • 10
  • 33