关于asp.net结合jquery时服务器控件id的解决办法

using your example:
<input name="ctl00$ContentPlaceHolder1$myTextBox"
type="text" id="ctl00_ContentPlaceHolder1_myTextBox" />

I use this to find the items i need.

$("input[id*='myTextBox']").

from Jquery.com "Matches elements that have the specified attribute and it contains a certain value."
docs.jquery.com/.../attributeContains

This way i don't have to inject server code. Also i can keep my javascript in a seperate js file with out dirtying up the design HTML code. Also I don't have to ad any attributes that aren't standard.
原文地址:https://www.cnblogs.com/shiningrise/p/1568806.html