Reputation: 5407
I have textbox element as below:
<input type="text" class="url" id="url" name="url" contenteditable="true" style=" text-align: left; height: 30px; width:512px; " placeholder="Enter URL ..."/></input>
When user perform button click action, in called function I want to change the ID of textbox.
Is there anything like
document.setElementID?
I have already created input element so this will not help:
var hiddenInput = document.createElement("input");
hiddenInput.setAttribute("id", "uniqueIdentifier");
Upvotes: 0
Views: 72
Reputation: 1074
var hiddenInput = document.getElementById ('url');
hiddenInput.id = 'uniqueIdentifier';
or with jquery :
$('#url').attr('id','uniqueIdentifier');
Upvotes: 2