patipat chewprecha patipat chewprecha - 1 month ago 19
PHP Question

Javascript not work in require php file on Class "content" AdminLTE

I have 2 page chemical_data.php and chemical_selectAll.php. I will test

alert()
on click button but button
id = "test1"
not show
alert('1')


chemical_data.php

<script>
$(document).ready( function() {

$('#OutputALLResult').load('chemical_selectAll.php');
$('#test').click(function(){
alert('1');
});
});
</script>
<!-- Main content -->
<section class="content">
<div class="col-md-12">
<div id="OutputResult"></div>
</div>
<hr>
<button class="btn btn-default" type="button" id="test">testClick</button>
<div id="OutputALLResult">Empty Data</div>

</section>


chemical_selectAll.php

<script>
$(document).ready( function() {
$('#test1').click(function(){
alert('1');
});
});
</script>
<button class="btn btn-default" type="button" id="test1">test1</button>

Answer

I not changed any code. But in my local server this works well. You can check what error occurred