O'Reilly logo

ASP.NET jQuery Cookbook - Second Edition by Sonal Aneel Allana

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Previewing image uploads in MVC

In this example, let's create an MVC application that can preview images using a client script prior to uploading it on the server. Note that this recipe only covers the client script, and the server code for the upload is not dealt with. The following table shows a quick summary of the constructs used in this example:

Construct

Type

Description

$("#identifier")

jQuery selector

This selects an element based on its ID.

.attr("name") OR

.attr("name", "value")

jQuery method

This returns a string with the required attribute value of a matched element. It can also be used to set the attribute to the required value.

change

jQuery event

This is fired when the value of an element changes. It corresponds ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required