Here is code which shows how to strike though the selected text
in textbox using JavaScript.
<script type="text/javascript" language="javascript">
    function sendtext(input) {
        var striketext = '';
        var textvar = $('#txtText').val().substr(input.selectionStart,
(input.selectionEnd - input.selectionStart));
       
$.each(textvar.split(''), function () {
           
striketext += '\u0336' + this;
        });
        var result = $('#txtText').val().substr(0,
input.selectionStart) + striketext + $('#txtText').val().substr(input.selectionEnd,
$('#txtText').val().length);
        $('#txtText1').val(result);
    }
</script>
<h2>Index</h2>
<input id="txtText" type="text">
<input id="txtText1" type="text">
<input type="button" value="click" onclick="sendtext(document.getElementById('txtText'))"/>
 
 
 
 
 
 
I really appreciate your professional approach. These are pieces of very useful information that will be of great use for me in future.
ReplyDelete