开发者

when i click on anchor i need to enable text field

开发者 https://www.devze.com 2023-01-18 07:35 出处:网络
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.

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 i开发者_如何学JAVAn advance


jQuery:

$('#click_me').click(function() {
  $('select-your-input-element-here').attr('disabled','');
});


$("#click_me").toggle( 
function () 
{ 
    $('#your_input_box').attr("disabled", true); 
}, 
function () 
{ 
    $('#your_input_box').removeAttr("disabled"); 
});

would possibly do the trick in jquery.


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

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

精彩评论

暂无评论...
验证码 换一张
取 消