In a text box, selected characters only display by an alert box. Need javascript code
- Himansu Ojha
- Query: 2 / Answer: 1
- Dipali Barma
- Query: 8 / Answer: 10
<form>
<Input type="text" id="text"><BR>
<INPUT type="button" onclick="disp()" value="click here" />
</form>
<script type="text/javascript">
function disp() {
var text = document.getElementById("text");
var t = text.value.substr(text.selectionStart, text.selectionEnd - text.selectionStart);
alert(t);
}
</script>
- Sikharani
- Query: 9 / Answer: 8
<form>
<Input type="text" id="text" onmouseup="disp();">
</form>
<script type="text/javascript">
function disp() {
var text = document.getElementById("text");
var t = text.value.substr(text.selectionStart, text.selectionEnd - text.selectionStart);
if(t!=''){
alert(t);
}
}
</script>
-
- Information
-
About Forum
This educational forum is produly developed by betaQsolutions-A leading software company in Odisha. This forum is developed to discuss the educational topics only betweeen the Students, teachers, Parents & Experts. Topic related to Career, Syllabus, Subjects, Questions, Exams etc are allowed to discuss here.
-
Statistics
Total topics 43 • Total Query 1115 • Total members 247 • Total Answered 1286