Men-Disable semua input type dalam Div Element dengan jQuery

#field1 -> berisi input form
#field1 -> berisi input form

Pilih salah satu yang mau diinput pake dropdown.

javascript :

<script type="text/javascript">

/// hide / show elements using dropdown
$('#dropdown_id').on('change', function(e){
var val = $(this).attr('value');
if(val == '1'){
     if(document.getElementById("field1").disabled == true){ dis(document.getElementById("field1")); }
     if(document.getElementById("field2").disabled == true){ dis(document.getElementById("field2")); }

/// disabled input element inside div id
function dis(el){
    try {
	el.disabled = el.disabled ? false : true;
    if (el.childNodes && el.childNodes.length > 0){
	for (var x = 0; x < el.childNodes.length; x++) 

This entry was posted in php. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.