JS or jquery methods for obtaining ASP.net server control IDs

Source: Internet
Author: User
Tags html tags

This article mainly introduces JS or jquery to obtain ASP.net server control ID method, this article introduces a method to solve the use of JS to obtain ASP.net control in the browser to generate HTML tags corresponding to the ID, the need for friends can refer to the

In the use of JS in asp.net, JS get dom elements, often not get, this is because the method is incorrect, now introduce a method to solve how to use JS to obtain ASP.net control in the browser to generate HTML tags corresponding to the ID

1. Get the ID of the label generated by the server-side control on the browser side, that is, the client HTML tag ID of the server control

The ClientID property of the server-side control allows you to obtain the corresponding ID value in the browser, the client HTML tag, for the following

The code is as follows:

The code is as follows:

<%= Newsid.clientid%>

2. Get the appropriate DOM elements through the DOM

It can be obtained through js,document or jquery, and here's a jquery example

The code is as follows:

var newsId = $ ("#<%= newsid.clientid%>");

3. Working with DOM elements

Now that you've got the elements you want to manipulate, then you can do the corresponding operation, and then you will see, start "Do as you please" ~ ~ ~

Note < > : More Wonderful tutorials please focus on Triple programming

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.