check if textarea or textfirld exists

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Barti

    check if textarea or textfirld exists

    is there any way to check if any textarea or textfield exists in current
    document
    fg
    function checkifexist(){
    if any textarea or textfield exist return true
    else return false
    }

    Barti


  • Vjekoslav Begovic

    #2
    Re: check if textarea or textfirld exists

    "Barti" <bart@spam-usun.sonik.pl> wrote in message
    news:blgrrs$3n6 $1@nemesis.news .tpi.pl...[color=blue]
    > is there any way to check if any textarea or textfield exists in current
    > document
    > fg
    > function checkifexist(){
    > if any textarea or textfield exist return true
    > else return false
    > }[/color]

    function checkifexists() {
    if (document.getEl ementsByTagName ("TEXTAREA").le ngth > 0)
    return true;
    else{
    var inputs=document .getElementsByT agName("INPUT") ;
    for (var i=0; i<inputs.length ;i++){
    if ((inputs.item(i ).type == "text") || (inputs.item(i) .type == "password") )
    return true;
    }
    }
    return false;
    }



    Vjekoslav


    Comment

    • Barti

      #3
      Re: check if textarea or textfirld exists

      [color=blue]
      > function checkifexists() {
      > if (document.getEl ementsByTagName ("TEXTAREA").le ngth > 0)
      > return true;
      > else{
      > var inputs=document .getElementsByT agName("INPUT") ;
      > for (var i=0; i<inputs.length ;i++){
      > if ((inputs.item(i ).type == "text") || (inputs.item(i) .type ==[/color]
      "password") )[color=blue]
      > return true;
      > }
      > }
      > return false;
      > }
      >[/color]
      thanks a lot :)


      Comment

      Working...