Solved

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

Posted on 2014-01-29
2
311 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
2 Comments
 
LVL 12

Accepted Solution

by:
Phil Phillips earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses how to create an extensible mechanism for linked drop downs.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now