jQuery Mobile ±íµ¥ÊäÈëÔªËØ

jQuery Mobile Îı¾ÊäÈë

ÊäÈë×Ö¶ÎÊÇͨ¹ý±ê×¼µÄ HTML ÔªËØ±àдµÄ£¬jQuery Mobile »áΪËüÃÇÉèÖÃרÃÅÕë¶ÔÒÆ¶¯É豸µÄÃÀ¹ÛÒ×ÓõÄÑùʽ¡£Äú»¹¿ÉÒÔʹÓÃÐ嵀 HTML5 <input> ÀàÐÍ£º

ʵÀý

<form method="post" action="demoform.asp">
  <div data-role="fieldcontain">
    <label for="fullname">È«Ãû£º</label>
    <input type="text" name="fullname" id="fullname">

    <label for="bday">ÉúÈÕ£º</label>
    <input type="date" name="bday" id="bday">

    <label for="email">µçÓÊ£º</label>
    <input type="email" name="email" id="email" placeholder="ÄúµÄÓʼþµØÖ·..">
  </div>
</form>

Ç××ÔÊÔÒ»ÊÔ

Ìáʾ£ºÇëʹÓà placeholder À´¹æ¶¨¼ò¶ÌµÄÌáʾ£¬ÒÔÃèÊöÊäÈë×ֶεÄÔ¤ÆÚÖµ£º

<input placeholder="sometext">

Îı¾¿ò

ÇëʹÓà <textarea> À´ÊµÏÖ¶àÐÐÎı¾ÊäÈë¡£

×¢ÊÍ£ºÎı¾¿ò»á×Ô¶¯À©´ó£¬ÒÔÊÊÓ¦ÄúÊäÈëµÄÎı¾ÐС£

ʵÀý

<form method="post" action="demoform.asp">
  <div data-role="fieldcontain">
    <label for="info">Additional Information:</label>
    <textarea name="addinfo" id="info"></textarea>
  </div>
</form>

Ç××ÔÊÔÒ»ÊÔ

ËÑË÷¿ò

ÊäÈëÀàÐÍ type="search" ÊÇ HTML5 ÖеÄÐÂÀàÐÍ£¬ÓÃÓÚ¶¨Ò幩ÊäÈëËÑË÷´ÊµÄÎı¾×ֶΣº

ʵÀý

<form method="post" action="demoform.asp">
  <div data-role="fieldcontain">
    <label for="search">Search:</label>
    <input type="search" name="search" id="search">
  </div>
</form>

Ç××ÔÊÔÒ»ÊÔ

µ¥Ñ¡°´Å¥

µ±Óû§Ö»Ñ¡ÔñÓÐÏÞÊýÁ¿Ñ¡ÏîÖеÄÒ»¸öʱ£¬»áÓõ½µ¥Ñ¡°´Å¥¡£

ÈçÐè´´½¨Ò»Ì×µ¥Ñ¡°´Å¥£¬ÇëÌí¼Ó type="radio" µÄ input ÔªËØÒÔ¼°ÏàÓ¦µÄ label¡£ÔÚ <fieldset> ÔªËØÖаü×°µ¥Ñ¡°´Å¥¡£ÄúÒ²¿ÉÒÔÔö¼ÓÒ»¸ö <legend> ÔªËØÀ´¶¨Òå <fieldset> µÄ±êÌâ¡£

Ìáʾ£ºÇëÓà data-role="controlgroup" ÊôÐÔÀ´×éºÏÕâЩ°´Å¥£º

ʵÀý

<form method="post" action="demoform.asp">
  <fieldset data-role="controlgroup">
    <legend>Choose your gender:</legend>
      <label for="male">Male</label>
      <input type="radio" name="gender" id="male" value="male">
      <label for="female">Female</label>
      <input type="radio" name="gender" id="female" value="female"> 
  </fieldset>
</form>

Ç××ÔÊÔÒ»ÊÔ

¸´Ñ¡¿ò

µ±Óû§Ñ¡ÔñÓÐÏÞÊýÁ¿Ñ¡ÏîÖеÄÒ»¸ö»ò¶à¸öÑ¡Ïîʱ£¬»áÓõ½¸´Ñ¡¿ò£º

ʵÀý

<form method="post" action="demoform.asp">
  <fieldset data-role="controlgroup">
    <legend>Choose as many favorite colors as you'd like:</legend>
      <label for="red">Red</label>
      <input type="checkbox" name="favcolor" id="red" value="red">
      <label for="green">Green</label>
      <input type="checkbox" name="favcolor" id="green" value="green">
      <label for="blue">Blue</label>
      <input type="checkbox" name="favcolor" id="blue" value="blue"> 
  </fieldset>
</form>

Ç××ÔÊÔÒ»ÊÔ

¸ü¶àʵÀý

ÈçÐè¶Ôµ¥Ñ¡¿ò»ò¸´Ñ¡¿ò½øÐÐˮƽ·Ö×飬ÇëʹÓà data-type="horizontal" ÊôÐÔ£º

ʵÀý

<fieldset data-role="controlgroup" data-type="horizontal">

Ç××ÔÊÔÒ»ÊÔ

ÄúÒ²¿ÉÒÔʹÓÃÓòÈÝÆ÷À´°ü×° <fieldset>£º

ʵÀý

<div data-role="fieldcontain">
  <fieldset data-role="controlgroup">
    <legend>Choose your gender:</legend>
  </fieldset>
</div>

Ç××ÔÊÔÒ»ÊÔ

Èç¹ûÄúÏ£Íû¡°Ô¤Ñ¡¡±ÆäÖÐÒ»¸ö°´Å¥£¬ÇëʹÓà HTML <input> ±êÇ©µÄ checked ÊôÐÔ£º

ʵÀý

<input type="radio" checked>
<input type="checkbox" checked>

Ç××ÔÊÔÒ»ÊÔ

VUE