Skip to content

If an optional attribute is omitted, the directive is not applied #3

@bbottema

Description

@bbottema
function hasRequiredAttributes(elem)
  {
    return elem.attr("type").toLowerCase() === "number" &&
      !isNaN(parseFloat(elem.attr("max"))) &&
      !isNaN(parseFloat(elem.attr("min"))) &&
      !isNaN(parseFloat(elem.attr("step")));
  }

!isNaN(parseFloat(elem.attr("max"))) results in false when the attribute is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions