How to add div block correctly?

majkrofajber

New Member
I have the following code which change simple text to textarea field:\[code\] $('.field').live({ mouseenter: function() { title='<?php echo $user_title; ?>'; old_value=http://stackoverflow.com/questions/11536338/$(this).text(); item_id=$(this).attr('id'); item=$(this).parent('td'); height=event.target.offsetHeight; width=event.target.parentNode.offsetWidth; new_value=http://stackoverflow.com/questions/11536338/(old_value=='Not translated') ? '' : old_value; $(this).empty(); var field=(title=='Login') ? "<textarea style='vertical-align: middle; font-family: Helvetica; font-size: 12pt; width: 212px;' id='new_value' name='term'>" + new_value + "</textarea>" : "<textarea style='vertical-align: middle; font-family: Helvetica; font-size: 12pt; width: 212px;' id='new_value' name='term'>" + new_value + "</textarea><div id='save_button' class='btn btn-primary' href='http://stackoverflow.com/questions/11536338/#'>>></div>"; $(this).html(field); $("#new_value").height(height); button_id=item_id.split('/')[0]; button_id=button_id.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1"); $("#"+button_id).show(); $("#new_value").click(function() { if (title=='Login') window.location.replace('<?php echo $fb_url?>'); }); }, mouseleave: function() { $(this).empty(); $(this).html(old_value); $("#"+button_id).hide(); alert($(this).html()); } } );\[/code\]div block for text:\[code\]echo "<td width='250'><div class='field' id='".$record['translate']['label_value']."/".$record['language_id']."'>".strip_tags($record['translate']['coalesce(loc.language_value)'])."</div>";\[/code\]It works correcly, but I need to add additional div block:\[code\]echo "<td width='250'><div class='field' id='".$record['translate']['label_value']."/".$record['language_id']."'><div style='width: 200px;'>".strip_tags($record['translate']['coalesce(loc.language_value)'])."</div></div>";\[/code\]After this action my code doesn't work! It changes text to textarea field, but in "mouseleave" event it doesn't work \[code\]$(this).empty()\[/code\] construction! Please, tell me, how can I fix it?
 
Back
Top