【问题标题】:how to remove the id attributr of element in a div jquery [duplicate]如何删除div jquery中元素的id属性[重复]
【发布时间】:2014-07-22 01:39:22
【问题描述】:

我想使用 jquery 从输入类型文本中删除属性 id="latlongclicked

<div id="divloc">
  <hr>
  <label>Address(optional)</label>
  <!--<label class=" remove  btn " >Remove</label>-->   
  <input name="addr[]" class=" form-control" type="text"  placeholder="Address"></input>

  <label>Location(required)</label>
  <input name="loc[]" class="form-control" type="text" required="true" placeholder="Location" id="latlongclicked" name="location"  readonly></input>
  <p class="description" style="font-size:10px;">Click on google map to set your location </p 
</div>

【问题讨论】:

标签: jquery


【解决方案1】:

你可以使用removeAttr函数:

$('#latlongclicked').removeAttr('id');

http://api.jquery.com/removeattr/

【讨论】:

    猜你喜欢
    • 2015-03-02
    • 2011-06-03
    • 1970-01-01
    • 2012-06-20
    • 2011-02-18
    • 2017-08-10
    • 2021-07-26
    • 1970-01-01
    相关资源
    最近更新 更多