Someone else said this earlier but seems worth repeating. If what you
want really is this:
>I'm trying to find the div with the class "property_container"
>(.property_container) that has the id "property_1530", where 1530 is a
>variable, propertyID.
You can boil that down to:
"I'm trying to find the div with the id "property_1530", where 1530 is
a variable, propertyID." Because the id is (or should be) unique.
find() will find child elements, the class you were looking for was on
the already found element.
Ensure that the id of your element is truly unique and, with the code
you have shown us, this should work...
var loginContainer = $('property_' + propertyID);
Dominic
On 16 December 2011 05:29, .jonah <[email protected]> wrote:
>
> I'd add <label> tags with for= attributes around all checkbox and radio
> button labels. (Ideally on labels for all form elements.) This is
> especially important on mobile where you need a larger area to click.
> Along that same vein, I'd add more spacing around each radio/checkbox to
> make it easier to select each with your fat finger. (Here's a post on
> element sizes for touchscreens: http://www.lukew.com/ff/entry.asp?1085)
>
> Cheers,
> .jonah
>
> On 12/15/11 9:20 PM, Rick Faircloth wrote:
>> Oh, yeah... it's a mobile site I'm working on,
>> converting a full real-estate site to a mobile version,
>> but you can see it at work in a browser or a smartphone at:
>>
>> http://hre-mobile.wsm-dev.com/modules/search-properties/search-properties.cf
>> m
>>
>> Any feedback is appreciated! It's a work-in-progress, but
>> almost complete. (As complete as it's going to get before
>> it's launched, anyway...)
>>
>> Rick
>>
>>
>>
>> -----Original Message-----
>> From: Rick Faircloth [mailto:[email protected]]
>> Sent: Friday, December 16, 2011 12:18 AM
>> To: cf-talk
>> Subject: RE: (ot) How would I write this js line?
>>
>>
>>>> If your html is:
>>>> <div class="property_container">
>>>> <div id="property_#propertyID#" class="login_container">
>>>> </div>
>>>> </div>
>> It's quite a bit more complicated, involving pre-written HTML,
>> HTML inserted via a cfc method use cfsavecontent which is written
>> into a .cfm file, then AJAXed into the pre-written HTML.
>>
>> The AJAXed in HTML contains the empty .login_container div,
>> which only gets its HTML if is needed and a jQuery function is
>> called and the push method is used to write the HTML into a
>> literal JS array, and then pushed into the DIV using the 'join' method.
>>
>> The hardest part is targeting the correct .login_container which
>> needs to receive the pushed JS-generated HTML, based on which
>> property the "star" graphic is being clicked by the user.
>>
>> Your last suggestion was close, but this finally (at least at first
>> attempt at 12:16 am (late!) seems to work:
>>
>> var loginContainer =
>> $('.property_container[id="property_'+propertyID+'"]').find('.login_containe
>> r');
>>
>> No errors appear in CFB2 initially, or in Firebug when the code is executed.
>>
>> I just pray this holds up under use tomorrow.
>>
>> Thanks for the feedback and suggestions!
>> Maybe we finally have a solution with this approach!
>>
>> Rick
>>
>>
>>
>>> -----Original Message-----
>>> From: Ricardo Russon [mailto:[email protected]]
>>> Sent: Thursday, December 15, 2011 10:38 PM
>>> To: cf-talk
>>> Subject: Re: (ot) How would I write this js line?
>>>
>>>
>>> Wouldn't there only be one of each ID?
>>> There should be. So in that case:
>>>
>>> var loginContainer =
>>> $('#property_'+propertyID).find('.login_container')
>>>
>>> Otherwise try
>>>
>>> var loginContainer =
>>>
>> $('.property_container[id='+property_'+propertyID+']').find('.login_containe
>>> r')
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349193
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm