javascript - issue with jquery toggle open/clos -


I have a small beam system and use the button to toggle the message on or off if someone If the message is not open, click on the button 'Lazen' button, opens this message and the text changes occur in 'Shlissen'. I can open the eve message, but can not close them, because the message is closed and once again Opens but shows buttontext, nevertheless' LeZe "I do hope that I think I tried to explain what :) This is my code:

This will set the reading to open the message database.

  & lt; Script type = "text / javascript" & gt; Function set read ($ id) {$. Ajax ({type: "POST", url: "update_pm_status.php", data: {id: $ id}}); }  

This message will open or close.

  & lt; Script type = "text / javascript" & gt; Function toggle openclose (id) {$ ('# message -' + ID). Slide Toggle ("Sharp"); If (document.getElementById (id) .innerHTML === "Legion") {document.getElementById (id). WinnerHTML = "schließen"; } And {document.getElementById (ID). WinnerHTML = "lesen"; }}  

  & lt ;? Php while ($ row = mysql_fetch_array ($ result)) {? & Gt; & Lt; Form action = "reply.php" method = "post" & gt; & Lt; P class = "button" & gt; & Lt; One class = "open-closed" & gt; & Lt; Div id = "container" & gt; & Lt; Div class = "item" & gt; & Lt; Span class = "toggle on" onclick = "setRead (this.id); Toggle Open Close (this.id);" Id = "& lt ;? php echo $ row ['id'];? & Gt;" Name = "gelesen" & gt; Lesen's & lt; / Span & gt; & Lt; Div id = "message- & lt ;? php echo $ line ['id'] ?? & gt;" Class = "toggle" & gt; & Lt; P & gt; & Lt ;? Php echo $ row ['nachricht']; ? & Gt; & Lt; / P & gt; & Lt; P & gt; & Lt; Input class = "button-link" type = "submit" name = "answer" value = "antivartne" & gt; & Lt; / Form & gt; & Lt; / P & gt; & Lt; P & gt; & Lt; Form action = "mailbox.fpp" method = "post" & gt; & Lt; Input type = "hidden" name = "id" value = "& lt ;? php echo $ line ['id'] ;;>" Gt; & Lt; Input class = "button-del" type = "submit" name = "delete_perm" style = "vertical-align: top; margin-top: 20px;" Value = "Löschen" & gt; & Lt; / P & gt; & Lt; / Form & gt;  

I still do not know what is wrong if I

  & lt; Script type = "text / javascript" & gt; $ (Function () {$ ('span.toggleOpen'). (Function () {$ (this) .next ('toggle'). Slidedown ("sharp");}); $ ('span. Toggleclose '). Click (function () {$ (this) .parents (' toggle '). SlideUp ("sharp");});});  

So it works, but I have to use two buttons (open and closed) and both are always shown. What I need is a button that changes the text by opening or closing the message.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -