开发者

jQuery rewrite copied text before pasting

开发者 https://www.devze.com 2023-03-26 06:05 出处:网络
I have a simple jquery script that copies a text from a html element and pastes it into a input fields value.

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

精彩评论

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