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 8586573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:20:30+00:00 2026-06-11T22:20:30+00:00

This snippet is from my admin. I have a description field next to an

  • 0

This snippet is from my admin. I have a description field next to an image, and a demo of how’d that look below it.

Right now it works after a page refresh but i’d like it to work asynchronously using AJAX, so as the user types it updates the demo below the textarea.enter image description here

#This is where you update the field
<tr><th>Description</th><td><%= f.text_area(:description) %></td></tr>

    <tr><th>Demo</th>
      <td>
      <% if @org.images.present?  %>
          <table border="0">
            <tr>
            <td>
            <%= featured_image_tag(@org, :type => 'organization')  %>
            </td>
            <td style="vertical-align:top;padding-top:5px;padding-left:5px;">
            <span class="font-avebook"><%= @org.description  %>  </span><br> 
            </td>
            </tr>
            </table>
          <% else   %>    
        You need to assoicate an image first before seeing the demo!
      <% end  %>    
    </td>
</tr>
  • 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-11T22:20:31+00:00Added an answer on June 11, 2026 at 10:20 pm

    To get the text to appear directly below at the same time as you’re writing you need to use a jQuery Keyup event to submit the data. However, submitting the data after each keyup is not the best idea. If you want to get that effect, why don’t you just do the whole thing with jQuery without actually saving the data. You can append the contents of the input to the element beside the image after each keyup. I’ve made a little demo below.

    <!DOCTYPE html>
    <html>
    <head>
      <script src="http://code.jquery.com/jquery-latest.js"></script>
    </head>
    <body>
      <input type="text" id="copy_text">
      <div id="mirror_paragraph"></div>
    <script>
        $("#copy_text").keyup(function () {
          var txt = $("#copy_text").val();
          $("#mirror_paragraph").html(txt);
        });
    </script>
    
    </body>
    </html>​​​​​​​​​​​
    

    Adapted to your code:

    <tr>
      <th>Description</th>
      <td><%= f.text_area(:description), :id => "copy_text" %></td>
    </tr>
    
    <tr>
      <th>Demo</th>
      <td>
        <% if @org.images.present? %>
            <table border="0">
              <tr>
                <td>
                  <%= featured_image_tag(@org, :type => 'organization') %>
                </td>
                <td style="vertical-align:top;padding-top:5px;padding-left:5px;">
                  <span class="font-avebook" id="mirror_paragraph"><%= @org.description %>  </span><br>
                </td>
              </tr>
            </table>
        <% else %>
            You need to assoicate an image first before seeing the demo!
        <% end %>
      </td>
    </tr>
    
    <script>
        $("#copy_text").keyup(function () {
          var txt = $("#copy_text").val();
          $("#mirror_paragraph").html(txt);
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to make this code snippet from the sinatra tutorial work so that
I have this snippet from my uploadify.php: if (!empty($_FILES)) { $name = $_FILES['Filedata']['name']; $tempFile
The following code snippet prints the Pascals triangle,I have got this snippet from the
This snippet from official website works as expected: $treeObject = Doctrine::getTable('Category')->getTree(); $rootColumnName = $treeObject->getAttribute('rootColumnName');
I tried to use this snippet from the Soundcloud API: <script src=http://connect.soundcloud.com/sdk.js> <script> SC.initialize({
I've just read this snippet from another answer : When you create a block
This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second)
I'm having problems with the getline instruction from fstream. this is a snippet from
This is a little snippet from a little flash game I'm working on: This
This is a code snippet from O'Reilly Learning Opencv, cvNamedWindow(Example3, CV_WINDOW_AUTOSIZE); g_capture = cvCreateFileCapture(argv[1]);

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.