Copying Field value to another field conditionally. Plz see the attached image for details.
I tried this code
<script type="text/javascript">
jQuery(document).ready(function($){
$('#field_iu157').change(function(){
var val1 = $("#field_iu157").val();
var val2 = $("#field_bclze").val();
if (val2 < val1) {
$("#field_bclze").val(val1);
}
});
});
</script>
But the problem is if the user write something on other fields from which 1st field is calculated then this code does not work.
Reigel Gallarde answers:
you should call $('#field_iu157').trigger('change');
every time you change the value of $('#field_iu157') in your code...
example: $('#field_iu157').val(value).trigger('change'),