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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:53:51+00:00 2026-05-27T04:53:51+00:00

in jQuery i tried: $(‘#imgAdd’).live(click, function() { if ($(‘#txtName’).val() == ) { $(‘#lblError’).show(); $(‘#lblError’).text()

  • 0

in jQuery i tried:

$('#imgAdd').live("click", function() {
    if ($('#txtName').val() == "") {
        $('#lblError').show();
        $('#lblError').text() = "Please enter a  Name";
        $('#txtMenuName').focus();
    }
    return false;
} 

but i got a error in console.

invalid assignment left-hand side
$(‘#lblError’).text() = “Please enter a Menu Name”;

I also want if text is entered in field automatically lblerror is hide. How do I achieve 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-27T04:53:52+00:00Added an answer on May 27, 2026 at 4:53 am

    Use:

    $('#lblError').text("Please enter a Menu Name");
    

    text() function is both a getter and a setter function. Thus, if you call it without parameters, you get the current text of the HTML element. But if you pass a parameter to it, you set the text of the HTML element.

    For hiding the error message, when user enters text into textbox, you can use keyup event handler of jQuery:

    $('#txtName').keyup(function(e){
       if($(this).val().length > 0) {
           $('#lblError').hide();
       }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried the jQuery and JavaScript solutions here: How to clear text field on
I tried to do this: try{ (function($){ ... my plugin stuff })(jQuery); }catch(er){ alert(an
I think there is a conflict with the way WordPress uses jQuery: Tried: (function($)
I tried jQuery get function and coded the below. What is wrong with my
I have this jquery $('input#application_submit.bigbutton[value=Agree]').click(function(e){ e.preventDefault(); var reason = $('.agree_reason:visible'); var reason_text = $('.agree_reason:visible
I'm looking for the best way to animate several divs onscreen. I tried jQuery,
I tried the jQuery fadeIn animation in all browsers and it work good, but
through jquery code i tried to add a new attribute called delaySrc to img
I tried to investigate the jQuery code, so I used this: document.write($.constructor); jsfiddle I
I tried manipulating fb_button_text value using jQuery but, it didn't work at all. Then

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.