其他分享
首页 > 其他分享> > html標籤內容補充

html標籤內容補充

作者:互联网

html標籤內容補充

input標籤
<div class="form-group" view-group=""> <label for="text" >:</label> <input id="text" name="text" type="text" class="form-control"> </div>
input內容補充:
$("#text").val("補充內容")

其他標籤如
<p id="p"></p> <span id="span"></span>
內容補充:
$("#P").html("張三")
$("#span").html("法外狂徒")select標籤<div class="form-group">
<label for="sel" class="col-form-label"></label>
<select id="sel" class="form-control">
        <option value="a" selected>A </option>
        <option value="b" selected>B </option>
    </select>
</div>   
內容補充:$("#sel").val("a")日期,不能直接val ,在時間為個位時需補0,如6-1需改為06-01
<input type="date" name="createdate" id="createdate" class="form-control" />
var date = new Date();
var Nowtime = date.format("yyyy-MM-dd");
$("#date").val(formatDate(Nowtime))
function formatDate(date) {
  if (date != "") {var date = new Date(date);
    var year = date.getFullYear();
    var day = ("0" + date.getDate()).slice(-2);
    var month = ("0" + (date.getMonth() + 1)).slice(-2);
    var format = year + "-" + month + "-" + day;
    return format;
  }
}

  

 

 

标签:val,html,內容,var,補充,date
来源: https://www.cnblogs.com/lixiaa/p/15030794.html