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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:18:49+00:00 2026-06-15T20:18:49+00:00

hi i want to trim the left space through java script when the value

  • 0

hi i want to trim the left space through java script when the value came from database i have used jsp tag for getting the value and loded these value in input field . i m facing problem when some space occur in starting of value then not even single value get printed in all input field

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script>
    function getValue() {
        <jsp:useBean id="ProjectBO"
    class="com.nousinfo.tutorial.employee.service.model.bo.EmployeeProjectBO"
    scope="request" />

        document.getElementById("empNumber").value = '<jsp:getProperty property="employeeNumber" name="ProjectBO"/>';



document.getElementById("projectCode").value = '<jsp:getProperty property="projectCode" name="ProjectBO"/>';
        document.getElementById("startDate").value = '<jsp:getProperty property="startDate" name="ProjectBO"/>';
        document.getElementById("endDate").value = '<jsp:getProperty property="endDate" name="ProjectBO"/>';
        document.getElementById("role").value = '<jsp:getProperty property="role" name="ProjectBO"/>';
    }
</script>
</head>
<body onload="getValue()">

    <form id="employee" action="ProjectUpdateServlet" method="post">

        <table width="1254" height="74" border="0" align="center">
            <tr>
                <td width="970" height="68" align="center" bgcolor="#99CCFF"><h2>
                        <span class="style1">Project Detail</span>
                    </h2></td>
                <td width="274" height="68" align="center" bgcolor="#FFFFFF"><img
                    src="/image/Emp.jpg" width="190" height="92" /></td>
            </tr>
        </table>
        <p>
            <br />
        </p>
        <hr size="1" width="786">
        <table width="786" border="0" align="center">
            <tr>
            <td><input type="hidden" name="updateStatusProject" value="M" /></td>

            </tr>
            <tr>

                <td width="298">Employee Number:</td>
                <td><input type="text" id="empNumber" name="employeeNumber" readonly="readonly" />
                </td>
            <tr>
                <td>Project_Code:</td>
                <td><input type="text" name="projectCode" id="projectCode"  readonly="readonly"/>
                </td>
            </tr>
            <tr>
                <td>Start_date</td>
                <td><input type="text" name="startDate" id="startDate" /></td>
            </tr>
            <tr>
                <td>End_date</td>
                <td><input type="text" name="endDate" id="endDate" /></td>
            </tr>
            <tr>
                <td>Role</td>
                <td><input type="text" name="role" id="role" /></td>
            </tr>
        </table>

        <p>&nbsp;</p>
        <br />
        <table width="200" border="0" align="center">
            <tr>

                <td><center>
                        <input type="submit" name="submit" value="Save" onclick="self.close()"/>

                    </center></td>

                <td><center>
                        <input type="button" name="cancle" value="Cancel"
                            onclick="self.close()">
                    </center></td>
            </tr>
        </table>
        <hr size="1" width="786">
        <p>&nbsp;</p>
    </form>
</body>
</html>
  • 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-15T20:18:50+00:00Added an answer on June 15, 2026 at 8:18 pm
    String.prototype.trim = function() {
        return this.replace(/^\s+|\s+$/g,"");
    }
    String.prototype.ltrim = function() {
        return this.replace(/^\s+/,"");
    }
    String.prototype.rtrim = function() {
        return this.replace(/\s+$/,"");
    }
    
    // example of using trim, ltrim, and rtrim
    var myString = " hello my name is ";
    alert("*"+myString.trim()+"*");
    alert("*"+myString.ltrim()+"*");
    alert("*"+myString.rtrim()+"*");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list that I want to loop through (for trimtemp in trim)
I want to trim the file extension from text I have an NSMutableArray in
I have a html file that I want to trim. I want to remove
I got the following entry in my database: images/test.jpg I want to trim the
Want to run javascript function from parent window in child window Example I have
Possible Duplicate: Creating generic arrays in Java I want to trim a generic array
I have following query: $ratings = RatingQuery::create() ->useProductsQuery('a', 'left join') ->filterByProductName('%'.trim($_REQUEST['title']).'%', Criteria::LIKE) ->endUse() ->groupByRatingModel()
I want to insert in a database some value when i click an image
Possible Duplicate: trim left characters in sql server? I have a query below that
Have decimal amount, want to trim to 2 decimal places if present

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.