Sorry, I don't understand what you're saying.

Here's my use case:

Page type 1:
<body class="pageTypeOne">
    <form ...>
        <input type="text" id="certainKindOfInputBox"/>
    </form>
</body>

Page type 2:
<body class="pageTypeTwo">
    <form ...>
        <input type="text" id="certainKindOfInputBox"/>
    </form>
</body>

I want my jQuery code to look like:

$(".pageTypeTwo #certainKindOfInputBox").click(function() { ... });

So that onclick only happens on my 2nd page type.  BTW, when I'm getting
this error is on a third page type, where there is no "pageTypeTwo" class or
"certainKindOfInputBox" ID.  (I.e. I would expect nothing to happen because
nothing matches the selector, but instead I'm getting an error.)


Olaf wrote:
> 
> jgrucza schrieb:
>> Yeah I know that, but consider this situation:
>> 
>> Two different kinds of pages each have an element with the same ID.  I
>> want
>> my Javascript to only affect the element on one of those pages.  So I
>> precede the ID with the class name I use for that page type, to target
>> the
>> right one.  Isn't this a reasonable use case?
>> 
>> Jennifer
> 
> Haha, Jennifer, you search a selector for
> 
> <div id="thisID" class="thisCLASS">
> 
> right? ;)
> 
> -- 
> Viele Grüße, Olaf
> 
> -------------------------------
> [EMAIL PROTECTED]
> http://olaf-bosch.de
> www.akitafreund.de
> -------------------------------
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/simple-selector-with-ID-doesn%27t-work-anymore-tf3080046.html#a8641246
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to