即時搜索需要用到input的propertychange,用法如下:
$('#addressSearch').on('input?propertychange',?function()?{ ? }); ?
獲取select的值。可以用change方法監(jiān)聽option內(nèi)的值的變化
例如:
$('.select').change(function(){})
獲取第一個option的值:$('.select ? ?option:first').val()
獲取選中的option的值:$('.select ? ?option:selected').val();
字?jǐn)?shù)控制:
$("#packagingDesc").on("propertychange?input",?function()?{??
????????var?$this?=?$(this),??
????????_val?=?$this.val(),??
????????count?="";??
????????if?(_val.length?>?512)?{??
????????????????$this.val(_val.substring(0,?512));??
????????????}??
????????count?=512?-?$this.val().length;??
? ? ? ? ?$("#text-count").text(count);??
????????});??