Follow Us

LightBlog

Breaking

Thursday, November 29, 2018

What is ($document ready) function in Jquery using Asp.net MVC

 What is ($document ready) function in Jquery using Asp.net MVC .

Step 1: Add a controller.



Step 2: Add View.


Step 3: Homecontroller

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace _document_ready_function_in__jquery.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }
    }
}


Step 4: In View


@{
    ViewBag.Title = "Index";
}
<script src="~/Scripts/jquery-1.10.2.min.js"></script>

<h2>What is $document ready function in jquery using Asp.net MVC.</h2>

<script>
    $(document).ready(function () {
        $('#buttin1').click(function () {
            alert('Jquery first programm in asp.net mvc');
        });

    });
</script>

<input type="button" id="buttin1" value="Click Button" />

Out put:






No comments:

Post a Comment