asp.net mvc - jquery selection problem -


On some watch pages I have two partial views (their html is similar). The first one works with this script but the other does not work

   

The problem comes when try to get article_number because I have two input boxes with some ID (id = marticlanknumber). If I change the second id for id = MArticleNumber1 So he has two article numbers but I have to do the action DevAccEditTemp only enable an article number. First, you can use more short-hand calls to get the value from an element with the ID (* details below).

itemprop = "text" See):

  var article_number = $ ("#MArticleNumber") val () .; Second, it is not valid for elements with the same ID ID must be unique according to HTML specifications: www.w3.org  

Your ID is unique By creating, you will have a problem.

(*) Explain why you should use the # selector instead of selector in [id = ...] in JQuery.

  $ ("# myElementId")  

Using the #id will result in a simple getElementById call, which is fast and simple. Therefore, the type of element is not relevant.

  $ ("Input [id = myElementId]")  

To display this lookup, you first get all input elements, then specify Loop around to find a match based on attribute search.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -