开发者

Id and name didn't get rendered for input

I have a button on my page, i.e:

<input type="button" id="myButton" name="myButton" class="mySty开发者_如何学运维le" 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.


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.


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.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜