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))
}
short answer is the button that has the event handler is not actually what you're clicking when trying to test since jQM transforms the button control. Hopefully this should help...
A.J
0 Points
3 Posts
javascript function doesnt work after using jquery function
Apr 24, 2012 07:59 AM|LINK
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" />
I think it has something to do with the postback. Please help.
kappos
Member
74 Points
22 Posts
Re: javascript function doesnt work after using jquery function
Apr 24, 2012 08:02 AM|LINK
Please formating your javascript welll.
A.J
0 Points
3 Posts
Re: javascript function doesnt work after using jquery function
Apr 24, 2012 08:09 AM|LINK
wangping8271...
Member
738 Points
145 Posts
Re: javascript function doesnt work after using jquery function
Apr 26, 2012 07:47 AM|LINK
Hi
short answer is the button that has the event handler is not actually what you're clicking when trying to test since jQM transforms the button control. Hopefully this should help...
http://forum.jquery.com/topic/calling-a-script-when-button-clicked
Try any of these links:
A.J
0 Points
3 Posts
Re: javascript function doesnt work after using jquery function
Apr 27, 2012 10:42 AM|LINK