3

I have a page where my server side button controlid renders as '_ctl0:btnInsComplete' but when I try to select my control by syntax $("#_ctl0:btnInsComplete"), It returns empty object .When I try with $("id$='_ctl0:btnInsComplete']") , It returns the button object. I want to understand why my first syntax is failing even though I am passing complete client side rendered controlid or am I making mistake? Can some one help in this ?

Sridhar R
  • 20,190
  • 6
  • 38
  • 35
user1461826
  • 207
  • 3
  • 10

3 Answers3

7

You are using : in button id so you need to escape it.

Use

$("#_ctl0\\:btnInsComplete")

Docs

To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\.

Satpal
  • 132,252
  • 13
  • 159
  • 168
0

try like this using Ends with Selector

$("[id$=btnInsComplete]")
0

Try this

$('button[id="_ctl0:btnInsComplete"]')

OR

$('[id="_ctl0:btnInsComplete"]')
Sridhar R
  • 20,190
  • 6
  • 38
  • 35