English 中文(简体)
在 <div> 和输出中获取文本
原标题:Get text in a <div> and output

使用jQuery UI, 允许用户在屏幕上拖动文字, 建立自己的句子,

我希望他们在点击Tweet按钮时, 将生成的文本输入Twitter文字区域。

我希望,有了PHP或JS, 就可以有办法输出已移入 div 的文本, 然后将其输入 & amp; text=Text% 20goes% 20 其中的Twitter代码 。

<a href="https://twitter.com/intent/tweet?button_hashtag=SUYearbook&text=Text%20goes%20here" 
   class="twitter-hashtag-button" data-size="large" 
   data-related="username">Tweet #SUYearbook</a>

如果您需要了解更多更多信息, 您可以在此看到此设置 : < a href="http://goo. gl/s6CBD" rel="no follow" >http://goo. gl/s6CBD

要重申: 将文字拖到区域中, 按下 Tweet 按钮( 或一个结束按钮) 时, 它会将文字内容添加到Twitter代码中, 然后在推特模式中放在那里 。

最佳回答

最简单的方式是将每个单词的 span 添加到区域中 ,然后用合适的单词绕过每个 span 。 类似 :

$(".twitter-hashtag-button").click(function(e) {
    e.preventDefault();
    var text = $(".selectedWord").map(function() {
        return $(this).text();
    }).get().join(   );
    window.location.assign("https://twitter.com/intent/tweet?button_hashtag=SUYearbook&text=" + text)
});
问题回答

您最好选择在目标 div 上使用 < code> dispopable 插件, 并使用接收事件将单词添加到 Twitter 链接 。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签