русский  עברית
tadam logo
דוגמאות jQuery
מצאתם שגיאה?
סמנו אותה עם העכבר ותלחצו
Ctrl + Enter
בדיקת כתיב Xhtml.co.il
Orphus system

סלקטור input

תיאור: תואם לכל האלמנטים קלט ( input, textarea, select, button).

jQuery(':input')

הוספה בגרסה: 1.0

סלקטור :input בעצם בוחר כל האלמנטים של הטופס.

דוגמאות

מחפש כל האלמנטים הקלט
    var allInputs = $(":input");
    var formChildren = $("form > *");
    $("#messages").text("Found " + allInputs.length + " inputs and the form has " +
                             formChildren.length + " children.");
	// so it won't submit
    $("form").submit(function () { return false; }); 
תוצאת הפעלה קוד לעיל:
קוד מלא:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>  
  <script>
  $(document).ready(function(){    
    var allInputs = $(":input");
    var formChildren = $("form > *");
    $("#messages").text("Found " + allInputs.length + " inputs and the form has " +
                             formChildren.length + " children.");
	// so it won't submit
    $("form").submit(function () { return false; }); 
  });
  </script>
  <style>
  textarea { height:25px; }
  </style>
</head>
<body>
  <form>
    <input type="button" value="Input Button"/>
    <input type="checkbox" />
    <input type="file" />
    <input type="hidden" />
    <input type="image" />
    <input type="password" />
    <input type="radio" />
    <input type="reset" />
    <input type="submit" />
    <input type="text" />
    <select><option>Option</option></select>
    <textarea></textarea>
    <button>Button</button>
  </form>
  <div id="messages">
  </div>
</body>
</html>
האם מידע זה היה מועיל?
   

תגובות