parse xml file with PHP and I want to delete elements by jQuery bas on user need -


this xml file, generted automatilcally want parse , modify content first want have delete action not work me.

<?xml version="1.0"?> <guide totalpages="1">   <guidetitle>testme</guidetitle>   <guidename>hawreguide2014030516131719</guidename>   <page number="1">     <content type="statement">statment test</content>     <content type="question type1" option1='op1' option2='op2'>can answer?</content>     <content type="question type5" option1="multiple choice1" option2="multiple choice2" option3="multiple choice3" option4="" option5="">multiple choice</content>   </page> </guide> 

this php code parsing

if (file_exists('../xmlpages/hawreguide2014030516131719.xml')) {     $xml = simplexml_load_file('../xmlpages/hawreguide2014030516131719.xml');            } else {             exit('failed open test.xml.');         } foreach($xml->children() $child)    {    echo $child->getname() . ": " . $child . "<br>";    if($child->getname() == 'page')    {        foreach($child->attributes() $key => $value) {         echo $value.'<br/>';         echo"<div id='pagesheet'> ";          }    }     foreach($child->children() $subchild)     {     echo"<br/><p>";  echo  "the question :::<input type='text' value='". $subchild ."'> " . $subchild ."<br>";          foreach($subchild->attributes() $key => $value) {             if($key =='type')             {                 echo "key ".$key." value ".$value.'<br/>';              }         else         {     echo "key ".$key." value<input type='text' value='". $value ."'> ".$value.'<br/>';              }   } echo"<button class='deletecon'> delete</button></p><br/>";           }     echo"</div>";    }  ?> 

and jquery script not work

$(".pagesheet").on("click", ".deletecon", function () {             $(this).closest("p").remove(); }); 

any idea, or did wrong? ur helps highly appreciated.

check ids , classes.

this echo"<div id='pagesheet'> "; , $(".pagesheet") not same.

use echo"<div class='pagesheet'> "; insteed.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -