Reputation: 5089
I have a button on my page, i.e:
<input type="button" id="myButton" name="myButton" class="myStyle" value="Click me" />
For some reason, the id or name didn't get rendered, therefore all my jQuery selector that selects ID are not working... Any idea why?
Thanks.
Upvotes: 0
Views: 94
Reputation: 5089
Completely stupid mistake by me and my co-worker! I originally used a partial view, my co-worker then copied the partial view html onto the actual view, removed the ID attribute. Then I've been pulling my hair out for the past day editing the partial view!
Upvotes: 0
Reputation: 34149
Perhaps you included another javascript on the page and $ no longer is a jquery function. You can try doing jquery("#myButton")
to see if it works.
Then of course, use firebug to see if there any javascript errors. You can also check to make sure the dom is parsed correctly by the browser.
Upvotes: 1
Reputation: 13709
You should be using $("#myButton")
to select this element. If that's not working, it's something else in your code that's causing the problem.
Upvotes: 0