• Resolved Neo

    (@neocsatornaja)


    The typed datas should look like this in case of Youtube videos <a href=""https://youtube.com/embed+ after the watch v (given by the user) " class="lightview"> and here comes the name of the video given by the user </a>.
    This link would be in the text area, and when he clicks on “watch in youtube “border””.
    Basic links:
    <a href"https://+ address given by the user"class="lightview">Link given by the user</a>
    If you can’t understand my question,please view my picture:
    https://www.kephost.com/view3.php?filename=a1_2013_7_22_mb42nuqo70.png

Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter Neo

    (@neocsatornaja)

    I create html form for your code ??
    https://jsfiddle.net/NeoCsatornaja/Bdy9n/3/

    Thread Starter Neo

    (@neocsatornaja)

    I found the solution and i like to show!
    Html:

    <p>
    	<label for="ytlink">Youtube.com/watch?v=</label>
    	<input type="text" id="yt_link" name="ytlink" />
    	<label for="ytlinkname">Video name:</label>
    	<input type="text" id="yt_link_name" name="ytlinkname" />
    	<input type="button" id="btn1" value="Video Paste" onclick="yt_link_transfer();" />
    </p>
    <p>
    	<label for="link">https://</label>
    	<input type="text" id="link" name="link" />
    	<label for="linkname">Link name:</label>
            <input type="text" id="link_name" name="linkname"/>
            <input type="button" id="btn2" value="Link Paste" onclick="link_transfer();" />
    </p>
    <input type="textarea" id="comment">

    Head with jqvery:

    function yt_link_transfer(){document.getElementById("comment").value += '<a href="https://www.youtube.com/embed/';document.getElementById("comment").value += document.getElementById("yt_link").value;document.getElementById("comment").value += '?autoplay=1';document.getElementById("comment").value += '" class="lightview">';document.getElementById("comment").value += document.getElementById("yt_link_name").value;document.getElementById("comment").value += '</a> ';}function link_transfer(){document.getElementById("comment").value += '<a href="https://';document.getElementById("comment").value += document.getElementById("link").value;document.getElementById("comment").value += '" class="lightview">';document.getElementById("comment").value += document.getElementById("link_name").value;document.getElementById("comment").value += '</a> ';}

    Thx for the support and work everyone,special thanks for:
    Ihor Vorotnov, you’re best!

    The script does basically the same but with pure javascript (my version was for jQuery). And separating YouTube and Link inputs is logical. Glad you managed to make it work! Good luck! ??

    Thread Starter Neo

    (@neocsatornaja)

    thx for the support.
    Can you share this the popular site?
    Sure many people will be looking for.
    Otherwise, jquery 2.0 works alone, so be sure to add: D
    if you think create the plugin this and lightview:D

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Could anybody help me solving this problem?’ is closed to new replies.