Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi i have created a favourites button using.append to store users response which is displayed onto the favourites page. I am trying to now use the same id's to store these responses in a textfield and mailto a email preferablly using a button of somesort.

What I have tried:

<pre> <!-- This is page 1-->
    <div data-role="page" id="item1">
     
      <div data-role="header" data-position="fixed"> <!-- header-->
        <h1>Item 1</h1>
      </div>
      
      <div role="main" class="ui-content"> <!-- main contain-->
      
      	<!-- buttons allowing navigation to item 1 and favourites pages-->
          <a href="#item2" class="ui-btn ui-btn-inline">Item 2 page</a>
          <a href="#favourites" class="ui-btn ui-btn-inline">Favourites page</a>
          
          <p>Here is all the details for item 1</p>

         <!-- favourites button-->
          <fieldset data-role="controlgroup" data-type="horizontal">
              <input type="checkbox" name="favourite1" id="favourite1" class="custom">
              <label for="favourite1"><span class="ui-icon-star ui-btn-icon-left">Add to favourites</span></label>
			  <div id="dog"><img id="theImg"  src="images/dog.png" />Where is the image?</div>
           </fieldset>
      
      </div> <!-- end main contain--> 
	 
     
   <!-- This is page 2-->
    <div data-role="page" id="item2">
     
      <div data-role="header" data-position="fixed"> <!-- header-->
        <h1>Item 2</h1>
      </div>
      
      <div role="main" class="ui-content"> <!-- main contain-->
      
      	<!-- buttons allowing navigation to item 2 and favourites pages-->
          <a href="#item1" class="ui-btn ui-btn-inline">Item 1 page</a>
          <a href="#favourites" class="ui-btn ui-btn-inline">Favourites page</a>
		 

          
          <p>Here is all the details for item 1</p>

         <!-- favourites button-->
          <fieldset data-role="controlgroup" data-type="horizontal">
              <input type="checkbox" name="favourite2" id="favourite2" class="custom">
              <label for="favourite2"><span class="ui-icon-star ui-btn-icon-left">Add to favourites</span></label>
           </fieldset>
      
      </div> <!-- end main contain-->




<!-- Favourites page -->
    <div data-role="page" id="favourites">
     
      <div data-role="header" data-position="fixed"> <!-- header-->
        <h1>Favourites</h1>
      </div>
      
      <div role="main" class="ui-content"> <!-- main contain-->
      
       <h1>Favourites</h1>
      
      	<!-- buttons allowing navigation to item 1 and item 2-->
          <a href="#item1" class="ui-btn ui-btn-inline">Item 1 page</a>
          <a href="#item2" class="ui-btn ui-btn-inline">Item 2 page</a>
          
          <div id="favourite-content"><p>My favourites: </p></div>
		  
		<div id="list"
		<form action="mailto:moksuhd.khan@gmail.com Feedback" method="post" enctype="text/plain">
			Email Adress:<br />
		<input type="text" id ="fav" name="email_address" value="" maxlength="100" /><br />

		<input type="submit" value="Submit" />

		</form>
		</div> 
			
      </div> <!-- end main contain-->



<pre><script>
	 $(document).on( 'pagecontainerbeforehide', 'body', function( event, ui){
	   //do something
	   if ( ui.nextPage.attr('id')== "favourites") {
		   $("#favourite-content").html ("");
		    if ($( "#favourite1" ).is( ":checked" )) {
				$("#favourite-content").prepend('<img id="theImg"  src="images/dog.png"/>');
			}
			 if ($( "#favourite2" ).is( ":checked" )) {
				$("#favourite-content").append("<p>item2 details</p>");
			}
		   
		  }
	   
	   });
	 
     </script>



$(document).ready(function(){
if( ('id')=="fav"){
$("#favourite-content").show();


});
Posted
Updated 21-Dec-20 2:38am
Comments
OriginalGriff 19-Dec-20 8:16am    
And?
What does it do that you didn't expect, or not do that you did?
What have you tried to do to find out why?
Are there any error messages, and if so, where and when? What did you do to make them happen?

This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Use the "Improve question" widget to edit your question and provide better information.

1 solution

I think you really need to learn how HTML and javaScript work.

How to use an ID to modify an element (like put text into it).
How to send data from the current page to a new page.

Really, just how the whole thing works.

You may wish to use the tutorials found here: W3Schools Online Web Tutorials[^]

You must understand these things in order to do any sort of web programming.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900