Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8165001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:26:20+00:00 2026-06-06T19:26:20+00:00

My script is here : jsfiddle i have two attributes in my form that

  • 0

My script is here : jsfiddle

i have two attributes in my form that my script do edit on a click in the div area/next to the link or double click on the link ( this how the script do the edit )

my problem is: if i have a textarea that includes an URLs per row and it sums all the chars in one link, if you see my example above, the link below is actually textarea with test1.com in first row and test2.com in second row, but the script shows this link : test1.comtest2.com, and i need it to be two link each one on a row, how can i do this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:26:21+00:00Added an answer on June 6, 2026 at 7:26 pm

    Refer this LIVE DEMO 2

    Addition to my previous answer, I have modified some parts of JQuery to handle your criteria.

    HTML:

    <table>
        <tbody>
            <tr>
                <td class="left">
                    <label>Date: </label>
                </td>
                <td class="cartRight">
                    <span id="status0" style="float:right;"/>2012-06-20
    </td>
            </tr>
            <tr>
                <td class="left">
                    <label>*Anchor Text </label>
                </td>
                <td class="cartRight">
                    <input type="text" value="dasdas" onchange="immediateEditItemInCart(this.value,'anchor_text',0,'pr','35')" class="mandatory0" readonly="readonly" id="anchor_text0"/>
                    <br/>
                </td>
            </tr>
            <tr>
                <td class="left">
                    <label>*URL </label>
                </td>
                <td class="cartRight">
                    <div style="padding:0 !important">
                        <div class="a0" style="padding:0 !important">
                            <a href="test1.com">test.com</a>
                        </div>
                        <input type="text" value="dsad.cas" onchange="immediateEditItemInCart(this.value,'url',0,'pr','35')" class="mandatory0" id="url0" style="display:none"/>
                    </div>
                    <br/>
                </td>
            </tr>
            <tr>
                <td class="left">
                    <label>Address </label>
                </td>
                <td class="cartRight">
                    <input type="text" value="dsada" onchange="immediateEditItemInCart(this.value,'address',0,'pr','35')" class="mandatory0" readonly="readonly" id="address0"/>
                    <br/>
                </td>
            </tr>
            <tr>
                <td class="left">
                    <label>Phone </label>
                </td>
                <td class="cartRight">
                    <input type="text" value="432423" onchange="immediateEditItemInCart(this.value,'phone_number',0,'pr','35')" class="mandatory0" readonly="readonly" id="phone_number0"/>
                    <br/>
                </td>
            </tr>
        </tbody>
    </table>
    <table>
        <tbody>
            <tr>
                <td class="left">
                    <label>Date: </label>
                </td>
                <td class="cartRight">
                    <span id="status4" style="float:right;"/>2012-06-22
    </td>
            </tr>
            <tr>
                <td class="left">
                    <label>*Anchor Text </label>
                </td>
                <td class="cartRight">
                    <input type="text" value="dasdasd" onchange="immediateEditItemInCart(this.value,'anchor_text',4,'am','30')" class="mandatory4" readonly="readonly" id="anchor_text4"/>
                    <br/>
                </td>
            </tr>
            <tr>
                <td class="left" style="vertical-align: top">
                    <label>*URL </label>
                </td>
                <td class="cartRight">
                    <div style="padding:0 !important;">
                        <div class="a0" style="padding: 0px ! important; display: block;width:200px;">
                            <a target="_blank" href="test1.com">test1.com</a><br/>
                            <a target="_blank" href="test2.com">test2.com</a><br/>
                        </div>
                        <textarea cols="82" onchange="immediateEditItemInCart(this.value,'url',4,'am','30');$(this).autoGrow();" class="mandatory4" id="url4" input="" style="height: auto; overflow: hidden; display: none;" rows="3">test1.com<br></br>test2.com<br></br></textarea>
                        <div class="clear">
            </div>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>​
    

    JQuery:

    $('.a0 a').click(function(){
        var href = $(this).attr('href');
    
        // Redirect only after 500 milliseconds
        if (!$(this).data('timer')) {
            $(this).data('timer', setTimeout(function() {
                window.open(href, '_blank')
            }, 500));
        }
        return false; // Prevent default action (redirecting)
    });
    
    $('.a0').dblclick(function(){
        var txt = document.createElement('div');
        $.each($(this).find('a'), function(i, val) {
            clearTimeout($(val).data('timer'));
            $(val).data('timer', null);
            $(txt).append($(val).text()); 
            $("<br>").appendTo(txt);
        });
        var content = $(this).parent().find('input,textarea');
        var text = "";
        $.each($(txt).html().split("<br>"), function(i, val) {
            if (val != "")
                text += val + "\n"; 
        });
        $(content).html(text);
        $(this).hide();
        $(content).show().focus();
    })
    
    
    $('#url0, #url1, #url4').each(function(index, element) {
        $(element).blur(function(){
            if ($(this).val().length == 0)
                $(this).show();
            else
            {
                var ele = this;
                var lines = $(ele).val().split("\n");
                var divEle = $(ele).hide().prev().show().empty();
                $.each(lines, function(i, val) {
                    $("<a />").html(val).attr({
                        'href': val, 
                        'target': '_blank'}).appendTo(divEle);
                    $("<br/>").appendTo(divEle);
                });
            }
        });
    });
    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple script that closes a DIV. An example is here: http://jsfiddle.net/22fTm/3/
I have a script here that if i click on it drops down, as
I have this bit of jQuery script that can be found here: http://jsfiddle.net/RUqNN/45/ When
I have a script on here that works fine in FF14 and Chrome20. A
I have a script over here: JsFiddle If you scroll down in the javascript
This script is working here https://jsfiddle.net/ByEzF/ but in the site that stopping working: <script
http://jsfiddle.net/HVGre/1/ - test link. I have an html link on my page that I
i have this script found here http://jsfiddle.net/g4txt/ i am using this carousel http://www.thomaslanciaux.pro/jquery/jquery_carousel.htm the
CODE HERE: http://jsfiddle.net/B7Y43/ Hello fello programmers, I have the following situation: My PHP-script generates
I have a cool script that works with two buttons. I need to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.