Solved

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

Posted on 2014-01-29
2
307 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
Comment Utility
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
Comment Utility
yes, exactly!  thank you.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Form submit issue 11 52
micro services vs rest web services 16 45
XSS cleaning when using ajax & json encode 5 38
JavaScript error 1 33
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This video teaches viewers about errors in exception handling.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

772 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

9 Experts available now in Live!

Get 1:1 Help Now