top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to settimeout inside the mouseover() or mouseenter() function in jquery?

0 votes
949 views

I tried the following code.But its not working.

$('#id').mouseover(function(e) {
 setTimeout('alert("Mouse Over Called")', 5000);
}
posted Aug 4, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Check this Code .It will work.

var timeout;

$('#id').mouseover(function(e) {
     timeout = setTimeout(function () {
         alert("Mouse Over Called");
     }, 5000);        
 });
answer Aug 8, 2014 by Manish Tiwari
Similar Questions
+1 vote

Am confused with these functions.Can any one tell me the difference and give some example for each .

0 votes

I tried the following code.Both onpaste() and Oncopy() will trigger when user trying to copy or paste.

But my problem is while copying something window.getSelection() not working.

Window.getSelection() is used to get the selected data.

I mean before copying something user need to select some values.So,using this window.getselection() we will get the value what they are selected.

Here, my problem is window.getselection() will work in oncopy but not working in onpaste.

Check the below examples and help me to solve the problem.

Also ,is there any alternative method also please let me know.I also tried window.clipboardData.But not getting the solution for this.

<!doctype html>
<html>
<head>
<style>
    textarea {
        width:500px;
        height:200px;
        border:2px solid #999;
    }
</style>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

    <script type="text/javascript">

        function OnPaste () {                                                                       
            var selection = window.getSelection();          
            alert(selection.toString());            
        }                                       
        function OnCopy() {         
            var selection = window.getSelection();
            alert(selection.toString());
         }

// Call the OnCopy function while user trying to copy 
document.oncopy = OnCopy;

// Call the OnPaste function while user trying to Paste
document.onpaste = OnPaste;
 </script>

</head>
<body>
    Select some text, copy it to the clipboard and try to paste it to the following fields:
    <br /><br />
    <textarea size="40" value="Copy and Paste operation is enabled">
+3 votes

I am having textbox and submit and close button. There is jquery validation on focusout of textbox. Which is fine. But when user type something in textbox and directly click the Close button i don't want to do validation. As focusout event fired first so validation work. I want button click event to fire first.

+3 votes

The browser i am using is google chrome. I also tested it in internet explorer and firefox too. But result is same. The post method is working fine for the same rest endpoint, but when i am trying to execute delete method on the same endpoint, it's throwing error with http status code 209 with the reason "failed to form full key for endpoint".

This is how the i am sending the delete request.

$.ajax({
             url: url,
             type: "DELETE",
             dataType:"json",
             data: JSON.stringify(data),
             crossDomain: true,
             contentType:"application/json",
             success:function(result){console.log("Success " + console.log(JSON.stringify(result)))},
             error:function(error){
                        alert("Error Deleting Service.See the console log.");
                        console.log(JSON.stringify(error));
                        },
             }).then(function(response){
                   console.log(JSON.stringify(response));
             });

The POST method:

 $.ajax({
                 url: url,
                 type: "POST",
                 dataType:"json",
                 data: JSON.stringify(data),
                 crossDomain: true,
                 contentType:"application/json; charset=utf-8",
                 success:function(){console.log("Success")},
                 error:function(error){console.log(JSON.stringify(error))},
                 }).then(function(response){
                      console.log(JSON.stringify(response));
                 });

Need help. I have already spent the day on this but not able to find the solution for this. I also tried to append the data params with the url but that too didn't worked.

0 votes

Please give the example for both.

...