/ / Wie bekomme ich das innere HTML eines wysihtml5 - Javascript, jquery, javascript-events

Wie bekomme ich die innere HTML eines wysihtml5 - Javascript, Javascript, Javascript-Events

Ich habe zwei wysihtml5-Felder, die auf einer Seite angezeigt werden. Ich möchte den Textbereich aktualisieren können class="vLargeTextField" mit text aus dem class="vLargeTextField wysihtml5-editor" in Echtzeit und umgekehrt. Wenn ich das aktualisiere id="user_input" class="vLargeTextField wysihtml5-editor" das id="user_input" class="vLargeTextField" sollte für die entsprechende Eingabe aktualisieren.

Ich habe versucht, ein paar Dinge zu tun:

Userinput1 = $(".wysihtml5-sandbox").contents().find("body").html()

Es funktioniert großartig, wenn ich nur einen Editor auf dem Bildschirm hätte. Es kehrt zurück user_input, aber wenn ich update user_input2Das mit einer ähnlichen Zeile wird der Code nicht. Auch wenn ich update user_input oder user_input2Würde ich gerne das entsprechende updaten class="vLargeTextField wysihtml5-editor" mit der Eingabe von user_input 1 oder 2.

Jede Hilfe dabei wäre sehr dankbar. Siehe den Code unten.

<div name="newboxes" id="user_input" class="text">
<div style="display:inline-block">
<textarea class="vLargeTextField" cols="80" id="user_input" name="results" rows="20" style="width: 640px; height: 200px; margin: 0px auto; display: none;"></textarea>
<iframe class="wysihtml5-sandbox" security="restricted" allowtransparency="true" frameborder="0" width="0" height="0" marginwidth="0" marginheight="0" style="background-color: rgb(255, 255, 255); border-collapse: separate; border: 0.9090908765792847px solid rgb(204, 204, 204); clear: none; display: inline-block; float: none; margin: 0px auto; outline: rgb(85, 85, 85) none 0px; outline-offset: 0px; padding: 3.9914772510528564px 5.994318008422852px; position: static; top: auto; left: auto; right: auto; bottom: auto; z-index: auto; vertical-align: middle; text-align: start; box-sizing: content-box; -webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 0.9090908765792847px 0.9090908765792847px 0px inset; box-shadow: rgba(0, 0, 0, 0.0745098) 0px 0.9090908765792847px 0.9090908765792847px 0px inset; border-top-right-radius: 3.9914772510528564px; border-bottom-right-radius: 3.9914772510528564px; border-bottom-left-radius: 3.9914772510528564px; border-top-left-radius: 3.9914772510528564px; width: 640px; height: 200px;"></iframe>

#document
<html>
<body marginwidth="0" marginheight="0" contenteditable="true" class="vLargeTextField wysihtml5-editor" spellcheck="true" style="background-color: rgb(255, 255, 255); color: rgb(85, 85, 85); cursor: auto; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13.63636302947998px; font-style: normal; font-variant: normal; font-weight: normal; line-height: 20px; letter-spacing: normal; text-align: start; text-decoration: none; text-indent: 0px; text-rendering: auto; word-break: normal; word-wrap: break-word; word-spacing: 0px;">
"Some Text Here"
</body>
</html>
</div>
</div>

<div name="newboxes" id="user_input2" class="text">
<div style="display:inline-block">
<textarea class="vLargeTextField" cols="80" id="user_input2" name="results" rows="20" style="width: 640px; height: 200px; margin: 0px auto; display: none;"></textarea>
<iframe class="wysihtml5-sandbox" security="restricted" allowtransparency="true" frameborder="0" width="0" height="0" marginwidth="0" marginheight="0" style="background-color: rgb(255, 255, 255); border-collapse: separate; border: 0.9090908765792847px solid rgb(204, 204, 204); clear: none; display: inline-block; float: none; margin: 0px auto; outline: rgb(85, 85, 85) none 0px; outline-offset: 0px; padding: 3.9914772510528564px 5.994318008422852px; position: static; top: auto; left: auto; right: auto; bottom: auto; z-index: auto; vertical-align: middle; text-align: start; box-sizing: content-box; -webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 0.9090908765792847px 0.9090908765792847px 0px inset; box-shadow: rgba(0, 0, 0, 0.0745098) 0px 0.9090908765792847px 0.9090908765792847px 0px inset; border-top-right-radius: 3.9914772510528564px; border-bottom-right-radius: 3.9914772510528564px; border-bottom-left-radius: 3.9914772510528564px; border-top-left-radius: 3.9914772510528564px; width: 640px; height: 200px;"></iframe>

#document
<html>
<body marginwidth="0" marginheight="0" contenteditable="true" class="vLargeTextField wysihtml5-editor" spellcheck="true" style="background-color: rgb(255, 255, 255); color: rgb(85, 85, 85); cursor: auto; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13.63636302947998px; font-style: normal; font-variant: normal; font-weight: normal; line-height: 20px; letter-spacing: normal; text-align: start; text-decoration: none; text-indent: 0px; text-rendering: auto; word-break: normal; word-wrap: break-word; word-spacing: 0px;">
"Some Text Here"
</body>
</html>
</div>
</div>

Antworten:

0 für die Antwort № 1

Ihre Frage hat mein Problem beantwortet. In Ihrem Fall habe ich gerade eine ID in den jQuery-Selektor eingefügt

Userinput = $("#user_input .wysihtml5-sandbox").contents().find("body").html()
Userinput1 = $("#user_input1 .wysihtml5-sandbox").contents().find("body").html()