PHP Codeigniter and jquery -



PHP Codeigniter and jquery -

hello totally new in codeigniter , jquery.below problem default button "simpan" , after click "simpan" button alter "ubah" , field disabled.problem cannot click button "ubah" , normal..anyone can help?

thanks you

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#sama<?php echo $row['br_loc'];?>").click(function(){ $("#test<?php echo $row['br_loc'];?>").hide(1000); $("#statussama<?php echo $row['br_loc'];?>").show(1000); $("#statustidaksama<?php echo $row['br_loc'];?>").hide(1000); }); $("#tidak<?php echo $row['br_loc'];?>").click(function(){ $("#test<?php echo $row['br_loc'];?>").show(1000); $("#statustidaksama<?php echo $row['br_loc'];?>").show(1000); $("#statussama<?php echo $row['br_loc'];?>").hide(1000); }); $("#simpan<?php echo $row['br_loc'];?>").click(function(){ $("#simpan<?php echo $row['br_loc'];?>").text("ubah"); $("tr.tr_<?php echo $row['br_loc']; ?>").addclass("disable_test"); $("#test<?php echo $row['br_loc'];?>").prop('disabled', true); $("#sama<?php echo $row['br_loc'];?>").prop('disabled', true); $("#tidak<?php echo $row['br_loc'];?>").prop('disabled', true); }); }); </script> <tr class="tr_<?php echo $row['br_loc']; ?>"> <td><?php echo $no; ?></td> <td><?php echo $row['br_loc']; ?></td> <td style="width:300px;"><?php echo $row['location']; ?></td> <td>rm <?php echo $row['sum']; ?> <input id="test<?php echo $row['br_loc'];?>" type="text" class="test" style="width:70px; display:none;"></td> <td><span id ="statussama<?php echo $row['br_loc'];?>" class="label label-success">sama</span><span id ="statustidaksama<?php echo $row['br_loc'];?>" style="display:none;" class="label label-warning">tidak sama</span></td> <td> <button type="button" id="sama<?php echo $row['br_loc'];?>" class="btn btn-success"><i class="icon-ok"></i></button> <button type="button" id="tidak<?php echo $row['br_loc'];?>" class="btn btn-danger"><i class="icon-remove"></i></button> </td> <td><a class="btn btn-primary" id="simpan<?php echo $row['br_loc'];?>" >simpan</a></td> </tr> <?php $no++; } ?>

i think shouldn't write js in loop. should write function js.

<tr class="tr_<?php echo $row['br_loc']; ?>"> <td><?php echo $no; ?></td> <td><?php echo $row['br_loc']; ?></td> <td style="width:300px;"><?php echo $row['location']; ?></td> <td>rm <?php echo $row['sum']; ?> <input id="test<?php echo $row['br_loc'];?>" type="text" class="test" style="width:70px; display:none;"></td> <td><span id ="statussama<?php echo $row['br_loc'];?>" class="label label-success">sama</span><span id ="statustidaksama<?php echo $row['br_loc'];?>" style="display:none;" class="label label-warning">tidak sama</span></td> <td> <button type="button" id="sama<?php echo $row['br_loc'];?>" class="btn btn-success"><i class="icon-ok"></i></button> <button type="button" id="tidak<?php echo $row['br_loc'];?>" class="btn btn-danger"><i class="icon-remove"></i></button> </td> <td> <a class="btn btn-primary" onclick="changestatus($(this))" id="simpan<?php echo $row['br_loc'];?>" >simpan</a> <input type="hidden" value="0" class="hd_status" /> </td> </tr> <?php $no++; } ?>

and function js

<script type="text/javascript"> function changestatus(el) { if(el.next().val() == 0) { //action el.next().val(1); } else { //action el.next().val(0); } } </script>

php jquery codeigniter

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -