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

  • Home
  • SEARCH
  • 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 3218414
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:31:30+00:00 2026-05-17T15:31:30+00:00

My buddy at work told me that you could use jQuery to write a

  • 0

My buddy at work told me that you could use jQuery to write a few lines of code that would find a single character (in this example '\0') and replace it for all textboxes and textareas on the page. Of course, he didn’t tell what lines of code would do that …

Is there a simple way to do this? We have a problem of people copying data from an old system and the data having a '\0' at the end of the text. This then gets saved in the database, and then when brought back from the database to the client, it causes an error.

EDIT: I agree with Magnar’s answer, but just for learning sake, does anyone know of a way to 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-05-17T15:31:31+00:00Added an answer on May 17, 2026 at 3:31 pm

    This isn’t a job for jQuery. I would strongly recommend you remove the null-character on the server side, for added stability and security reasons.

    However, this is how you would do it (slightly verbose):

    var remove_null_character = function () {
        var field = $(this),
            old_value = field.val(),
            new_value = old_value.replace('\0', '');
        field.val(new_value);
    };
    $("input:text, textarea").live("blur", remove_null_character);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

DataAnnotations does not work with buddy class. The following code always validate true. Why
I have gotten the code to work so that when I press the button,
<%= link_to 'Show', buddy, :only _ path => false %> Doesn't seem to work.
I have a buddy that's having a hard time with the language barrier. I
I have the following code that sends a message using the mail() function. Everything
I have some event handlers that work in FF and not in Safari. Simply
I have this regex I built and tested in regex buddy. _ [ 0-9]{10}+
I work for a medical transcription company and our medical transcription test we administer
I am doing development work on a site with a strange server set up
I've got a staging server with Git on it, my buddy and I push

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.