亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

用JS插入值

用JS插入值

守候你守候我 2023-07-14 09:45:50
我有以下 html:<div class="col-md-1 col-lg-1 text-center"><input name="flash_price" type="hidden" id="test" value=""><input name="from" type="hidden" value=""><input name="to" type="hidden" value=""><button type="button" id="my" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="<div class='form-group row'><label class='col-sm-2 control-label'>Price<span class='text-danger'>*</span></label><div class='col-md-8 col-lg-10'><input name='special_price' type='text' class='form-control'></div></div><p>This product shall be displayed on the Flash sale. Creating flash sales increases the chance of product being sold.</p><div class='form-group row'> <label class='col-sm-2 control-label'>From<span class='text-danger'>*</span></label> <div class='col-md-8 col-lg-10'> <input name='starting_date' type='datetime-local' class='form-control' required value></div></div><div class='form-group row'><label class='col-sm-2 control-label'>To<span class='text-danger'>*</span></label> <div class='col-md-8 col-lg-10'> <input name='ending_date' type='datetime-local' class='form-control' required value></div></div><a id='optBtn' class='btn btn-primary input-group-addon'>OK</a>" title="" data-html="true" data-original-title="Flash Sales Price" aria-describedby="popover917523"><i class="fa fa-edit"></i></button></div>我正在嘗試用 js 來增加價值,如下所示:$(this).parent('col-md-1').find('input[name=flash_price]').attr('value', 'test value);但當我嘗試$(this).parent('col-md-1').find('input[name=flash_price]').attr('id');這樣做時,它說未定義。我在那里做錯了什么?
查看完整描述

1 回答

?
楊__羊羊

TA貢獻1943條經驗 獲得超7個贊

把你的js改成這樣
$(this).parent('.col-md-1').find('input[name ="flash_price"]').val('test value');

查看完整回答
反對 回復 2023-07-14
  • 1 回答
  • 0 關注
  • 102 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號