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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:19:12+00:00 2026-06-18T01:19:12+00:00

in my jsp page i have two divs and a textbox with a default

  • 0

in my jsp page i have two divs and a textbox with a default value as follows

<input type="text" value="somevalue"  id="box"/>
<div id="first" style="display:none"></div>

<div id="second"></div>

In script tag i have written as follows

<script>
$(document).ready(function()
{
    if($("#box").val()=='somevalue')
    {
        $('first').show();
        $('second').hide();
    }
});
</script>

The above code is running fine..but when the page loads the second div is coming for 1 second and then switching to first div..and i dont want that switching to appear..

  • 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-18T01:19:14+00:00Added an answer on June 18, 2026 at 1:19 am

    You said it’s in a JSP page, so you can put conditional logic in on the server-side and determine which of the two <div> elements should be hidden before it even gets to the browser. There’s absolutely no reason to use jQuery to solve this, and doing so is (in my opinion) the wrong approach.

    Assuming you’re using the JSTL core tag library:

    <c:set var="yourValue" value="somevalue"/>
    <input type="text" value="somevalue"  id="box"/>
    <div id="first" <c:if test="${yourValue != 'somevalue'}">style="display:none"</c:if>></div>
    
    <div id="second" <c:if test="${yourValue == 'somevalue'}">style="display:none"</c:if>></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my jsp page i have one text box and two combo box. An
I have a jsp page having two text field id and name. Now I
I have two jsp files as follow: myform.jsp <%@ page contentType='text/html; charset=UTF-8' errorPage='' %>
I have a JSP page and a servlet.The JSP has two input, one being
I have two text boxes in my jsp page. After entering data on first
i have two select input fields in a jsp page. i want to disable
I have one jsp page which contains two text fields Start Date and End
I have this strange behavior in my JSP page: I have two Integer variables
In my .jsp page I have <s:url id=ecu value=ecu-info-detail> <s:param name=id value=%{id}></s:param> <s:param name=ecuName
I have two jsp(one is main page, another one is new window) and single

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.