• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 32
  • Last Modified:

value in jQuery not working

Hi

I have the following code applies to td in a table:

$(".cerrado").click(function(){
		$(this).html('<input type="text" value='+$(this).text()+'>')
		$(this).unbind('click');
		});

Open in new window


my problem is that when a td have that contains 04/17/2015 16:05:44, then when click only appears 04/17/2015

what i can do?
0
joyacv2
Asked:
joyacv2
1 Solution
 
Rainer JeschorCommented:
Hi,
the text of the TD contains a space.
Therefore you would have to encapsulate the value inside double quotes:
		$(this).html('<input type="text" value="'+$(this).text()+'">')

Open in new window

Live sample:
http://jsfiddle.net/EE_RainerJ/a7w21cmv/

HTH
Rainer
0
 
joyacv2Author Commented:
perfect!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now