Created
March 2, 2013 09:13
-
-
Save xirukitepe/5070257 to your computer and use it in GitHub Desktop.
setAttribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#add-item").click(function() { | |
var divs = document.getElementsByClassName('budget-field'); | |
var divs2 = document.getElementsByClassName('mini-field'); | |
var divs3 = document.getElementsByClassName('text-area'); | |
var divs4 = document.getElementsByClassName('check-box'); | |
var divs5 = document.getElementsByTagName('select'); | |
for (i = 0; i < divs.length; i++) { | |
divs[i].setAttribute('readonly',true); | |
} | |
for (i = 0; i < divs2.length; i++) { | |
divs2[i].setAttribute('readonly',true); | |
} | |
for (i = 0; i < divs3.length; i++) { | |
divs3[i].setAttribute('disabled', true); | |
} | |
for (i = 0; i < divs4.length; i++) { | |
divs4[i].disabled = true; | |
} | |
for (i = 0; i < divs5.length; i++) { | |
divs5[i].setAttribute('disabled', true); | |
} | |
}); | |
$("#update").click(function() { | |
var x = document.getElementsByClassName('budget-field'); | |
for (i = 0; i < x.length; i++) { | |
x[i].setAttribute('readonly','false'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment