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

Adding items to controls at runtime

In this recipe, we will use jQuery to add items to different ASP.NET controls, such as DropDownList, ListBox, and BulletedList at runtime. The constructs used in this example are summarized as follows:

Construct

Type

Description

$("#identifier")

jQuery selector

This selects an element using its ID

$.map()

jQuery function

This transforms an array or object into another array

.append()

jQuery method

This inserts content at the end of each matched element

.click()

jQuery event binder

This binds a handler to the click event of an element

event.preventDefault()

JavaScript function

This prevents the default action of the event from being triggered

.focus()

jQuery event binder

This ...

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