Skip to main content

Posts

Showing posts with the label data

jQuery - filter element based on .data() key/value

Say I have 4 div elements with class .navlink , which, when clicked, use .data() to set a key called 'selected' , to a value of true : $('.navlink')click(function() { $(this).data('selected', true); }) Every time a new navlink is clicked, I would like to store the previously selected navlink for later manipulation. Is there a quick and easy way to select an element based on what was stored using .data() ? There don't seem to be any jQuery :filters that fit the bill, and I tried the following (within the same click event), but for some reason it doesn't work: var $previous = $('.navlink').filter( function() { $(this).data("selected") == true } ); I know that there are other ways to accomplish this, but right now I'm mostly just curious if it can be done via .data() . Thanks. Source: Tips4all

How to replace the string values stored with in a variable in objective c

I got an xml in output for the webservices.I have the result in the variable and i stored the result in that variable.Now i want to replace the strings in that variable.How to replace the strings in that variable. For ex: //SDZZmaterialGroupList* result = (SDZZmaterialGroupList*)value; in that result variable i stored the result is: </Text></item> <item> <Matkl>00101</Matkl> <Text>Steels</Text> </item> <item> <Matkl>00107</Matkl> <Text>Miscelleanous</Text> </item> <item> <Matkl>002</Matkl> <Text>Electronics</Text> </item> <item> <Matkl>00207</Matkl> <Text>Monitors</Text> </item> <item> <Matkl>003</Matkl> <Text>Bulbs</Text> </item> <item> <Matkl>007</Matkl> <Text>Services</Text> </item> <item> <Matk

I"ve got a stack with this API Respond data

lets to the point : I've got respond code like this string(141) "000|0123456789| 0987654321|namexxxxx|081xxxx|10000|1231231230|namexxxxxx|081xxxx|10000|3213213210|namaxxxxxx|081xxxx|10000 |page|total_page" (i've make it bold for the main data) There's 3 main data. The main data is dynamic( the ID is in front of name, the last data is "10000"), and max is 10 loop's. How i can take the main data with PHP ? Help :)