I have a list in this basic format (2 items in the following example - be aware I had to put onClick outside of the <'li'> element, otherwise it was not displaying correctly):
I can probably add in a 4th param that I pass which would be the customer_name value, but I would like to avoid this if I can. Can anyone give me some guidance on this?
True wisdom is in knowing you know nothing - Socrates
Bear Bibeault wrote:It is not valid to have multiple elements with the same id and nothing will work as expected until you fix this.
Hmm well I must have mis stated something or be missing something, because this has been working like this for quite some time now. I am not sure what you mean when you say nothing will work as expected.
I will see what else I can figure out :/
Well unfortunately I do not have direct access to fix this myself, but I have passed it along. Thanks for the help. Unfortunately for now I still have to work with this as it is, so I am going to have to figure something else out.
So I know that the thing to do is fix this id issue, but putting that aside for now - could there be a way to work with this as it is and accomplish what I am trying to do?
I notice that I can use $(this).html(); to return the html of one list item at a time. Is it possible to extract the value I need from that by id? Something like $(this).html().($("#customer_name"))
I know that probably will not work, but just to give an idea of what I mean. I know I can probably get it using something like substr and/or instr, but that is not exactly desirable.
Someone also mentioned XPath as a possibility.
Also, the display of this list is incorrect in IE9 (but not IE8, FF or chrome) - the list is off to the right, but corrects itself once you select one of the items - could the id issue mentioned cause this kind of thing?
Joined: Nov 08, 2001
Well it has the class set, so use that, also why are you using onclick in the html, add it dynamically!