I have string that contains some div's how to get one of them by id ?
EDIT
I'm using right click selection plugin, so when i select a div .
$("#first #second").contextMenu({
menu: 'myMenu'
},
function(action, el, pos) {
switch (action) {
case "do":
{
and the selection is basicley
$(el).html()
So this is the code that contains the html that is in #second, but the #second isn't one div , it is a'lot of divs with that id, and i want when i click on that div to select certain id and get it's context . Is there a easyer way ?
You can have jquery interpret a string as a set of tags like this:
$(htmlstring);
So something like this might work:
$("<div><div id='test'></div></div>").find("#test");
Edit: Now with the updated question this is of course not what you want.
You can't have more than one element with the same id. IDs are supposed to be unique identifiers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With