?
Solved

basic JS question:  greater than 0 but less than x?

Posted on 2014-01-29
2
Medium Priority
?
323 Views
Last Modified: 2014-01-29
function handleCharacterCheck(dialog) {
              if ($("#" + dialog).val().length < 300 ) {
                  $("#charNotEnough").html($("#" + dialog).val().length);
                  $("#dialogNotEnoughCharacters").dialog("open");
                  return false;
              }

I need to change that so that instead of the check being < 300, it must also be greater than 0.  (so greater than 0 and less than 300) How can I do that?
0
Comment
Question by:arthurh88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
Phil Phillips earned 2000 total points
ID: 39819610
Could do something like:

function handleCharacterCheck(dialog) {
              var len = $("#" + dialog).val().length;
              if (len > 0 && len < 300) {
                  $("#charNotEnough").html(len);
                  $("#dialogNotEnoughCharacters").dialog("open");
                  return false;
              }

Open in new window

0
 

Author Comment

by:arthurh88
ID: 39820134
yes, exactly!  thank you.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to implement server side field validation and display customized error messages to the client.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question