Jquery學習--選擇器$("input:first").val()

 $("form").submit(function() {
      if ($("input:first").val() == "correct") {
        $("span").text("Validated...").show();
        return true;
      }
      $("span").text("Not valid!").show().fadeOut(1000);
      return false;

    });



  <form action="javascript:alert('success!');">
    <div>
      <input type="text" />


      <input type="submit" />
    </div>
  </form>



筆記:

<input   typpe = "text" />

<input  type="submit" />

只有兩個,input  類型----用這種方法取值



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章