Page 1 of 1

Using JavaSript to change count in list count property

Posted: Wed Apr 30, 2014 3:31 pm
by RobertJay

What is the best way to do this - thank you.


Using JavaSript to change count in list count property

Posted: Wed Apr 30, 2014 3:33 pm
by Maryna Brodina

Hello!

Could you clarify your question in more details?


Using JavaSript to change count in list count property

Posted: Wed Apr 30, 2014 3:44 pm
by RobertJay

Hi Maryna... sure: I have a mobile list called 'boblist' with an item named "messages" which has the counter visible property set to true. I want to set that counter value programmatically. Thanks.


Using JavaSript to change count in list count property

Posted: Wed Apr 30, 2014 9:46 pm
by Maryna Brodina

Try this code:
pre$("#start_mobilelistitem_23 span").text('100');/pre
where start_mobilelistitem_23 - id of your list item.


Using JavaSript to change count in list count property

Posted: Wed Apr 30, 2014 11:39 pm
by RobertJay

Thank you Maryna... but unfortunately it does not seem to work. Do you think it needs some type of refresh?


Using JavaSript to change count in list count property

Posted: Thu May 01, 2014 3:24 am
by Yurii Orishchuk

Hi Robert.

Please try this code:

pre
code

jQuery('[name="messages"]:eq(0) .ui-li-count').text("counter_text")

/code
/pre

Where:

"messages" - is your listitem name. Like you mentioned above.

"eq(0)" - get first item. If you want to get 2nd item, you should to use "eq(1)" and so on.

Also if you have some problem with this code, please provide us details about how did you tryed it. Perhaps screen shots.

Regards.


Using JavaSript to change count in list count property

Posted: Thu May 01, 2014 2:41 pm
by RobertJay

That works perfectly Yurii - thanks a million.