Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts
Step 1:

 <div>
           <label for="tags">Tags: </label>
            <input id="tags" />
 </div>

Step 2:

<script>

var sourcedata = [
    "asp.net",
    "Asp",
    "BASIC",
    "C",
    "C++",  
    "COBOL",
    "Fortran",
    "Java",
    "JavaScript",
    "Lisp",
    "Perl",
    "PHP",
    "Python",
    "Ruby",
    "Scala",
    "Scheme"
    ];
$("#tags").autocomplete({
    source: sourcedata,
    open: function (event, ui) {

            var adddiv = $("<div style=\"width: auto; background: #f5f5f5;border-top: 1px solid #c7c7c7;margin-top: 0.92307692em; padding: 0 0.46153846em;overflow: hidden;\"> Close</div>", {

            });
        adddiv.click(function () {
            $(event.target).autocomplete("close");
        });
        $(this).autocomplete("widget").append(adddiv);
    }  
   
});

</script>

Page refresh

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-2.1.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            setTimeout(function () {
                window.location.reload();
            }, 60 * 1 * 1000);
           
            //Page refresh after 40 min -
            //Example :- 60 * 40 * 1000
            //Format:-  60 * (minute) * 1000
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <h1>Page refresh after 40 min </h1>
       <h2>
       Refresh Page 40 minute </h2>
       or
       <h3>Refresh Page for interval</h3>
       or
       <h4>Automatically reload a web page at a certain time</h4>
        <br />
       Or you can set value to refresh page
    </div>
    </form>
</body>
</html>


remove only html tags in a string 


var s = '<span>javascript</span> programming language'; 
var r = /<(\w+)[^>]*>.*<\/\1>/gi;
alert(s.replace(r,""))
Step 1:  Go to http://jquery.com/download/
Step 2:  Click the "Microsoft CDN"
Step 3:  Accrording to download your versinon like jquery version 1.10.0
Step 4:  Download the vsdoc file (jquery-1.10.0-vsdoc.js).
Step 5:  The -vsdoc.js or .debug.js file must be located in the same folder as the javascript library

Or you can download

http://archive.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
        <script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(
            function () {
                $('html, body').animate({ scrollTop: ($("#DivContent2").offset().top - 100) }, 'slow');
            });

        function clickwithbtn()
        {
            $('html, body').animate({ scrollTop: ($("#DivContent2").offset().top - 100) }, 'slow');
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div><input type="button" value="Click" onclick="clickwithbtn()" id="btnClick" /> </div>
      <div id="DivContent1" style="height:1300px; width:600px;">
          scroll to element with jQuery
      </div>
    <div id="DivContent2" style="height:1200px;width:600px;">
        focus to div is working
    </div>
    </div>
    </form>
</body>
</html>

Step1: Create an array
Step2: Use the grep() method of jQuery, which takes  parameters.
            First parameter is array.


var x = [9, 10, 11,12,13,14,15]
var removeData = 12;

x = jQuery.grep(x, function(value) {
 return value != removeData;
     });

-----------------------------
Output:-
[9, 10, 11,13,14,15]
$('form[id^="form1"]').find("input:radio:checked").prop('checked',false);
$('input[class="booknow"]').val("Change Submit");

<input type='text' class="booknow" value="BOOK" name='project'>option</input>

Previous PostOlder Posts Home