When a user focuses on an input box with id #title-title the div with widgettitle class should be replaced with the text in the input box. <script type=\"text/javascript\"> $(document).ready(function(){ $('#title-title').focus(function() { $('.widgettitle').replaceWith('<h4 class="widgettitle">'+$("#title-title").text()+'</h4>'); }); } </script> <html> Blah Blah <input type="text" name="title-title" id="title-title" class="tooltip-editor" value="Title"> Code (markup): Doesn't seem to work.
try $('.widgettitle').html("<h4 class='widgettitle'>"+$('#title-title').val()+"</h4>"); Code (markup):
@klown You seem not to know the jQuery functions. try visualjquery.com, use it whenever you are not sure. Hope it helps