开发者

jQuery rewrite copied text before pasting

I have a simple jquery script that copies a text from a html element and pastes it into a input fields value.

var txt=$('div').text();
$('#name').val(txt);

The problem I have is that I need to rewrite some of the text that has been copied before adding it to the input field.

When the text is copied and pasted it shows '%40' I need to rewrite '%40' and make it an '@' symbol.

Could somebody please 开发者_StackOverflow社区help?


Try the unescape function: unescape(txt) For example: unescape("email%40example%2ecom") returns "email@example.com"

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜