Click to See Complete Forum and Search --> : Adding " " to a (element value)


and
07-11-2008, 03:56 AM
Hello,

I want to insert " " to the . which have the text i am interested in.
copyToClipboard is a javascript.


<input type="button" VALUE="Copy to clipboard" onClick="copyToClipboard({.})"></input>

What I get with this code is for example
Text to be copied

but this isn't a string so it don't get copied to the clipboard

What i want is something like this:

<input type="button" VALUE="Copy to clipboard" onClick="copyToClipboard({"."})"></input>
So i get
"Text to be copied"

bogocles
07-11-2008, 01:00 PM
Not really sure what the '{.}' signified (place holder?), but it sounds like your asking how to get quotes around some text?

I don't know what copyToClipboard achieves or needs, but this should give you a string with quotes around it:


<html>
<head>
<script type="text/javascript">

function copyToClipboard ( text ) {

alert ( '"' + text + '"' );

}

</script>
</head>

<form>
<input type="button" value="Copy to Clipboard" onclick="copyToClipboard( this.value );" />
</form>

</html>

and
07-14-2008, 06:08 AM
Thanks