So I'm having some issues with my code. I'm trying to remove a link (a) and then after that add a new link (a) with different text.
Here's the 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');
});
