$(document).ready(function () {
//input加上刪除按鈕
? ? var $inputText =$("input[type='text'][name='name'],input[name='awardName'],input[name='typeName'],input[name='qutoaFormulateName'],input[name='userName'],input[name='unitName']");
? ? $inputText.wrap('<span></span>');
? ? $inputText.parent().css({
"position":"relative"
? ? });
? ? $inputText.keyup(function() {
$(this).change();
? ? });
? ? $inputText.change(function() {
if ($(this).val() !="" &&$(this).parent().find("i").length <=0) {
// console.log("改變了");
? ? ? ? ? ? var $mThis =this;
? ? ? ? ? ? $(this).parent().append("<i class='Hui-iconfont clear_btn' style='display:block;position: absolute;top: 0;right:5%;'></i>");
? ? ? ? ? ? $(".clear_btn").click(function() {
$(this).parent().find("input").val("");
? ? ? ? ? ? ? ? $(this).remove()
});
? ? ? ? }else if ($(this).val() =="" &&$(this).parent().find("i").length >0) {
$(this).parent().find("i").remove();
? ? ? ? }
});
});