Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: New to Java but have a problem appending a srtring to another.

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Location
    London
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile New to Java but have a problem appending a srtring to another.

    Trying this but have a problem.


    <script
    src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
    $("#btn1").click(function(){
    $("p").append(" $comment");
    });
    $("#btn2").click(function(){
    $("ol").append("<li>Appended item</li>");
    });
    });
    </script>
    </head>
    <body>

    <p>This is a paragraph.</p>
    <p>This is another paragraph.</p>

    <ol>
    <li>List item 1</li>
    <li>List item 2</li>
    <li>List item 3</li>
    </ol>

    <button id="btn1">Append text</button>
    <button id="btn2">Append list item</button>

    You see I want to append $comment which I can see with php echo $comment

    I have not been able to attached the comment text tried all I can think of the variables do not appear to be seen in the code.

    I really just want to do the append without the button action so that it flows into the next code..


    Any help would be appreciated as I could not find an append code in PHP?

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: New to Java but have a problem appending a srtring to another.

    This looks like a javascript problem. Java is a different language.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2021
    Location
    London
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: New to Java but have a problem appending a srtring to another.

    Its from jQuery on W3 schools

    Found in html5/css3 for dummies by Andy Harris page 814

Similar Threads

  1. Java XML: IndexOutOfBoundsException When appending a node
    By priere in forum What's Wrong With My Code?
    Replies: 5
    Last Post: June 4th, 2013, 09:36 PM
  2. Trouble appending data to Excel
    By loui345 in forum What's Wrong With My Code?
    Replies: 14
    Last Post: November 26th, 2012, 02:37 PM
  3. Appending to online documents
    By aussiemcgr in forum Java Theory & Questions
    Replies: 3
    Last Post: August 2nd, 2011, 08:44 AM
  4. Appending to excel using POI
    By krishnamohan in forum Java Theory & Questions
    Replies: 8
    Last Post: August 19th, 2010, 05:40 AM