开发者

make a label textbox after click [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be 开发者_开发技巧reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

i have amount column in a table that shows on web page.

what i want to do is when page open up to show amount as label.

when user clicks on the amount it becomes editable like textbox.


Do you mean something like this (using jQuery):

<span id="amount">3.25</span>
<input id="amount_entry" name="amount" style="display:none;"></input>

$('#amount').click(function() {
    $('#amount').css('display', 'none');
    $('#amount_entry')
        .val($('#amount').text())
        .css('display', '')
        .focus();
});

$('#amount_entry').blur(function() {
    $('#amount_entry').css('display', 'none');
    $('#amount')
        .text($('#amount_entry').val())
        .css('display', '');
});

Sample demo: http://jsfiddle.net/LFgxr/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜