views:

57

answers:

3

I have a anchor tag, with id="click_me". When i click on this i should enable input text (<input type="text" id="summary" class="summary">), which is disabled first.

even i can do it using javascript function, by calling these javascript function() using onclick in the tag; but in my application i shld not use these.

I am newbie to php. please suggest me any alternative solution either using DOM or anything else. Thanks in advance

+2  A: 

jQuery:

$('#click_me').click(function() {
  $('select-your-input-element-here').attr('disabled','');
});
Alec
He can't use Javascript, so use jQuery instead?
Pekka
It's tagged jQuery - I think he means "I shouldn't be using inline javascript"
Mez
@Mez yeah, true. The question could use some clarification
Pekka
+1  A: 
$("#click_me").toggle( 
function () 
{ 
    $('#your_input_box').attr("disabled", true); 
}, 
function () 
{ 
    $('#your_input_box').removeAttr("disabled"); 
});

would possibly do the trick in jquery.

Ross
A: 

Having this somewhere in your <head> section will work:-

<script>
$(document).ready( function() {
    $('#click_me').click( function() {
        $('#textarea').removeAttr("disabled");
    };
});
</script>
Mez