如何在div jquery中删除元素的id属性

时间:2014-07-22 01:39:22

标签: jquery

我想使用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>

1 个答案:

答案 0 :(得分:1)

您可以使用removeAttr功能:

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

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