1
Is there any way to check if a div has an id, using jQuery?
I can check if he has an ID value, so:
<div id="main">...</div>
if ($("#main").length){
// resto do código aqui
}
But what I need is to know if the DIV
has a id
within it.
EXAMPLE 1:
I have the following div
<div class="menu"></div>
JQuery here has to tell me he doesn’t have id
EXAMPLE 2:
I have the following div
<div class="menu" id='4'></div>
JQuery here has to tell me that the div has one id
You can do it?
I don’t understand what you want... to me that what you said you wanted to do, is what you’re doing
– LocalHost
I changed my question, look if you understand now.
– Hugo Borges