Find an element in a div using the attribute ends selector

I am trying to find hidden element in a div using the attribute ends with selector and I am running into issues.

I have a jQuery object which represents div and I know that my hidden input is in this div and it ends with "-id", but I am not able to locate it.

This is my code

var clickedContainer = $(theThis).parent().parent().parent();
var id = clickedContainer.find([id$='-id']).val();

I get an error on the second line.

I guess, I don't know how to find an element in a div which is represented by a jQuery object.


You probably need to quote your argument to find():

var id = clickedContainer.find("[id$='-id']").val();

(Just a note: when you say you "get an error", it's usually a good thing to actually say what the error message is.)

Need Your Help

Azure blob storage - chunked file upload - caching data across postbacks

c# azure azure-storage-blobs azure-caching

I've been following this example for uploading large files from an MVC web app to Azure blob storage in chunks.

How to get from an EditPart to its Editor in Eclipse? (Eclipse plug-in development)

eclipse editor plugins

I am writing an eclipse plug-in that extends editor. Inside the editor I put some EditParts. From some of these edit parts I need a reference to their encapsulating editor (so that for example, w...