A.J
A.J

Reputation: 141

javascript functions doestnt work after using jquery

I am using this jquery to have spell check on the textarea. Spell check works fine but after using jquery for spell check my other javascript functions are not working. Any idea why ?

<script type="text/javascript">
    $Spelling.SpellCheckAsYouType('txt_comment1');
    function showselected() {
        var input1 = document.getElementById('txt_comment1');
        var startPos = input1.selectionStart;
        var endPos = input1.selectionEnd;
        var doc = document.selection;

        if (doc && doc.createRange().text.length != 0) {
            alert(doc.createRange().text);
        } else if (!doc && input1.value.substring(startPos, endPos).length != 0) {
            document.getElementById('txt_addwords').value = input1.value.substring(startPos, endPos);
            //alert(input1.value.substring(startPos, endPos))
        }
    }
</script>

<asp:Button 
    ID="cmd_submit_good" 
    runat="server" 
    Height="38px" 
    OnClientClick="showselected();" 
    onclick="cmd_submit_good_Click" 
    Text="Good Word" 
    Font-Bold="False" 
    Font-Names="Arial" Font-Size="X-Small" 
    Width="80px" />

Upvotes: 1

Views: 184

Answers (1)

A.J
A.J

Reputation: 141

http://forum.jquery.com/topic/calling-a-script-when-button-clicked, I got the answer fro this link. Jquery transforms the actual text box that is why javascript wasnt executing on the original text box.

Upvotes: 1

Related Questions