Having some trouble with my code here. I need to remove a link (a) and replace it with a new link (a) that has different text.
This is the current code:
HTML:
<label for="name" class="control-label">Username:</label>
@<a href="<?php echo $username ?>">
<p class="text-info-username">
<?php echo strtolower($username) ?><i class="icon-star"></i></a></p>
<div class="controls-username">
<a href='#' id="edit-username" class="btn"><i class="fa fa-pencil"></i> Edit</a>
</div>
Script:
$('#edit-username').click(function() {
var text = $('.text-info-username').text();
var input = $('<input type="text" placeholder="' + text + '" id="editTextBox" />')
$('.text-info-username').text('').append(input);
$('#edit-username').remove();
$('<a href='#' id="update" class="btn">Update</a>').appendTo('.controls-username');
$('<br /><br />').insertAfter('.controls-username');
});