in the append i would like to add the following code:
<ul data-role="listview"> <li> <a href="#"> <img src="chrome.png"> <h2>Google Chrome</h2> <p>Google Chrome is a free, open-source web browser. Released in 2008.</p> </a> </li> </ul>
Would be easier to hide and show the list, rather than add it programmatically.
i am working in jquery mobile and this is the only way to do it i think?
i have a favourites page, when a user clicks the favourite button for a specific item, i want to show a list view on a different page, but i dont know how to add html code into the append function
i am working in jquery mobile and this is the only way to do it i think?
i have a favourites page, when a user clicks the favourite button for a specific item, i want to show a list view on a different page, but i dont know how to add html code into the append function
Write the markup where you want it to be, and set it to display: none. You can then show and hide the element.
so for example if i have the following code below :
<ul data-role="listview"> <li> <a href="#"> <img src="chrome.png"> <h2>Google Chrome</h2> <p>Google Chrome is a free, open-source web browser. Released in 2008.</p> </a> </li> </ul>
how would i have that initially hidden?
and then how would i show it in the append function?
so for example if i have the following code below :
<ul data-role="listview"> <li> <a href="#"> <img src="chrome.png"> <h2>Google Chrome</h2> <p>Google Chrome is a free, open-source web browser. Released in 2008.</p> </a> </li> </ul>
how would i have that initially hidden?
and then how would i show it in the append function?
Give the list an ID. Apply display: none as a style. Don't use .append() - use .show() instead.
ok i have given it an id and i have set it to display:none.
at the moment its not showing up
so what do i need to put after .show() ? what goes inside the brackets?
Nothing, by default. Call the function on the element, it is as simple as that. The documentation for jQuery is pretty good if you need further clarification.
Nothing, by default. Call the function on the element, it is as simple as that. The documentation for jQuery is pretty good if you need further clarification.