The reason I've used $('.property_container[id="property_'+propertyID+'"]')
to this point is that the determination as to which particular
.property_container
comes into play is based on which .star_01 (star graphic) is clicked.
That .star_01 star graphic is used to find the .property_container is
involved:
$('.star_01').click(function) {
$(this).parent().parent();
});
In that section of code "$(this).parent().parent()" becomes
.login_container.
It may be a weird way to go about getting this done, but I'm trying to
code on pain medicine from neck surgery last week and my code is
suspect, to say the least. I'm surprised I can get anything to work at all!
:o)
Rick
-----Original Message-----
From: Dominic Watson [mailto:[email protected]]
Sent: Friday, December 16, 2011 12:47 PM
To: cf-talk
Subject: Re: (ot) How would I write this js line?
Ah ok, so the html you posted was incorrect yes? i.e.
<div class="property_container">
<div id="property_#propertyID#" class="login_container">
</div>
should have been:
<div class="property_container" id="property_#propertyID#">
<div class="login_container"></div>
</div>
I realize you have it working, but I'd recommend looking at your selector
again:
$('.property_container[id="property_'+propertyID+'"]').find('.login_containe
r');
You are looking for an element with a class that also has a particular
id. IDs should be unique, therefore looking for the class should be
redundant. Selecting just the id should both perform and read better:
$('#property_' + propertyID).find('.login_container');
HTH
Dominic
On 16 December 2011 10:40, Rick Faircloth <[email protected]> wrote:
>
> Thanks for the feedback, Dominic...
>
> This works:
>
> var loginContainer =
>
$('.property_container[id="property_'+propertyID+'"]').find('.login_containe
> r');
>
> I'm actually looking, first, for the .property_container with the correct
> propertyID,
> then the .login_container inside that.
>
> Rick
>
> -----Original Message-----
> From: Dominic Watson [mailto:[email protected]]
> Sent: Friday, December 16, 2011 4:02 AM
> To: cf-talk
> Subject: Re: (ot) How would I write this js line?
>
>
> 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:349203
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm