Completely new to JQuery so read some of the documentation here:
I am trying to change an input from disabled to enabled on user click. I used this code which works fine:
$('#edit1').click(function(){
$('#doc1').removeAttr('disabled');
});
I then wanted to loop through it for every value of edit1 and doc1 i.e. edit2 and doc2...etc.
I have tried this:
$(document).ready(function () {
var max = 6;
var i = 0;
var x = 0
if (x < max) {
i++
x++;
$('#edit${i}').click(function () {
$('#doc${x}').removeAttr('disabled');
})
}
};
And can be seen here:
http://jsfiddle.net/Rockhopper92/9oapaf1k/
Now this does somehow "look" wrong to me but can't put my finger on it. I have a feeling it's to do with where I'm opening and closing my brackets or some really fundamental error like the opening line '$(document).ready(function()'
This is my first attempt at JQuery so any general pointers would be a massive help to me.