开发者

How to copy the following text from input box?

I've got the following input box...

<input type="text" id="sharees" class="form_field_as">

and I'm using the following to attempt to capture what is typed..

var txt2 = $('input[class="form_field_as"]').serialize();

However, that doesn't seem 开发者_运维技巧to be working. it's returning "". What am I doing wrong?


try

var txt2 = $('input.form_field_as').val();

or by id

var txt2 = $('#sharees').val();


Try

$(function(){
    $('input.form_field_as').keyup(function(){
        var txt2 = $('input.form_field_as').val();
        $('p').text(txt2);
    })
});

Your code is wrong. That type of writing is used for other attributes. For an id use # and for a class use ..

http://jsfiddle.net/borayeris/qGT4W/1/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜