• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • Last Modified:

Echo Variable Javascript

The following code I'm having some issues with.  I need to echo the variable "qtycheck" to see if it's getting populated correct as I suspect that's the issue.

How can I echo it out on the page to see?

<script type="text/javascript">
    function check() {
        var elements = document.getElementsByName("quantity");
        var qtycheck = document.getElementById("qtycheck").value;
        for (var i=0; i<elements.length; i++) {
            var nmbr = elements[i].value;
            if (nmbr > <?php echo $maxqtyorder; ?>){
                alert("You've selected more treats than your package allows.");
                return false;
            }
            else if (nmbr > qtycheck){
                alert("You've selected more treats than your package allows.");
                return false;
            }
        }
        return true;
    }
</script>

Open in new window

0
Nathan Riley
Asked:
Nathan Riley
  • 2
1 Solution
 
Lee SavidgeCommented:
Pop it to a dialog box

alert(qtycheck);

Open in new window


You could also use
document.write(qtycheck);

Open in new window

0
 
Nathan RileyFounder/CTOAuthor Commented:
@Isavidge

Where in my code would I input that?
0
 
Nathan RileyFounder/CTOAuthor Commented:
Nevermind, got it thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now