Javascript Onclick Highlight To Select And Copy
- Forums
- Javascipt
- Javascript Onclick Highlight To Select And Copy
This Page Contains information about Javascript Onclick Highlight To Select And Copy By hotsalsa in category Javascipt with 3 Replies. [2179], Last Updated: Mon Jun 24, 2024
hotsalsa
Wed Jun 04, 2008
3 Comments
626 Visits
how do i enable automatic select a text field with javascript?
i mean if i have a form and i want the user to just click the field and be able to copy
function select_all(obj)
{ var text_val=eval(obj);
text_val.focus();
text_val.select();
if(!document.all) return; // IE only
r= text_val.createTextRange();
r.execCommand('copy');
}
</script>
<p>Text Field:
<input name="textfield" type="text" size="40" value="click here to highlight" onclick="select_all(this)">
</p>