im create on selected Startup Script.
$(document).ready(function() {
$(‘#x_nohp’).hide();
$(‘#x_nopol’).hide();
$(“input[name=‘x_Pilih’]”).change(function() { // Assume Field1 is a text input
if (this.value == “nohp”) {
$(‘#x_nohp’).show();
$(‘#x_nopol’).hide(); // Set value to FieldA
} else if (this.value == “nopol”){
$(‘#x_nopol’).show(); // Set value to FieldB
$(‘#x_nohp’).hide();
}
});
i use select on this field .but this code not work
i need when input x_pilih
works according to the logic that I wrote.
thanks
Try to use:
$(‘#r_nohp’).hide();
instead of
$(‘#x_nohp’).hide();
if you use x it will only hide the field, with r you will hide the entire row. You should do it everywhere if you want to hide the entire row.
try to use:
$(“#x_Pilih”).change(function() {
var str = $(“option:selected”, this);
if (this.value == “nohp”) {
…
…
…
.
}).change();
doing this the script will check every change in “Pilih” field and activate your script.
the “}).change();” at the end will execute the script automatically 1 time when the page finish to load.
instead of
$(“input[name=‘x_Pilih’]”).change(function() {
if (this.value == “nohp”) {