Solved

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

Posted on 2014-01-29
2
320 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 13

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JDBC performance 8 29
Popup write two lines 3 22
Html date format 9 20
Scroll 5 news at a time using vticker 2 11
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

726 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