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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:22:03+00:00 2026-05-15T20:22:03+00:00

I have a field that is dynamically being filled. I know that the first

  • 0

I have a field that is dynamically being filled. I know that the first few words of the string are always going to be:

The order was manually edited:

This is followed by a list of all the edits that was made. This list can be somewhat long sometimes.

I want to hide the list of edits, and replace it with a button that says ‘Click to View Edits’. When the user clicks the button it will make the list of edits appear above the button and will change the button text to ‘Hide Edits’.

My thought-process was to use a jquery function to find “The order was manually edited:” and then select the rest of the string and save it into a variable, then I need make it hide the complete string and show the above string along with button. When the user clicks the button it will simply toggle the string that was saved into the variable(the list of edits).

The string I am searching in is

.note_message

I am somewhat lost how I can achieve this. I found the :contains selector but I wasn’t sure how to select only the list of edits and not the string I am searching for. How can I go about doing what I am trying to do?

  • 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-05-15T20:22:03+00:00Added an answer on May 15, 2026 at 8:22 pm

    If you have control of the output of the page then the best way to do it is just to create a div or span or similar which is what you want to hide.

    <span id="editsToHide">These are my edits</span>
    

    And then you can find this easily with $('#EditsToHide')

    http://jsfiddle.net/8q8ds/ is an example of the code you want (probably could be done more stylishly and more neatly but its a proof of concept that shoudl get you thinking in the right direction.

    Note I also added in stuff to make it work on non-JS browsers by having CSS hide the button and not the edits and then teh javascript hides the edits and shows the buttons. No JS means it will show the data always rather than have it hidden with no way to get to it. 🙂

    Edit:

    To do it without control of the markup you need to add in your own markup. I’ve done a new fiddle based on the old one here: http://jsfiddle.net/8q8ds/2/. The key new code is:

    var messageText = $('.note_message').html()
    var staticText = 'The order was manually edited:<br/>';
    var dynamicText = messageText.substring(staticText.length-1);
    var newHTML = staticText + '<span id="editsToHide">'+dynamicText+'</span>'
    $('.note_message').html(newHTML);
    

    You can see it finds the contents of your “note_message” span (note if there is more than one of these unexpected behaviour may occur). It then chops off the known part to get the unknown part (you may want to do some validation to make sure the bit you chop off was actually what you expected in case of changes to outputted HTML). It then constructs some new HTML with a span to give it the format as described above and then continue as before.

    Hope this helps.

    Edit 2: Just updated the second jsfiddle since I realised I wasn’t dynamically adding the button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that is dynamically built after looking up a field list
In my asp.net-mvc website I have a field that usually has a string (from
I have one field that I need to sum lets say named items However
I'm using SQL Server 2005. I have a field that must either contain a
I have a table that records a sequence of actions with a field that
I have a table with one field that can point to a foreign key
I have a field in a database that is nearly unique: 98% of the
I have a field in my form labeled Name that will contain both the
I have a field in my report that needs to have a length of
I saw that __VIEWSTATE field gets rendered even though I have set the EnableViewState=false

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.