javascript - jhtmlarea not working inside updatepanel -
i have jhtmlarea textarea on form
textarea id="txtdigital" name="txtdigital" class="form-control" style="background-color:white; resize: vertical !important; " rows="20" placeholder="details" runat="server"></textarea>
which being set in javascript with:
$(document).ready(function () { $(function () { $("#<%=this.txtdigital.clientid%>").htmlarea({ toolbar: [ ["bold", "italic", "underline", "strikethrough"], ["increasefontsize", "decreasefontsize", "forecolor"], ["orderedlist", "unorderedlist", "superscript", "subscript"], ["indent", "outdent", "justifyleft", "justifycenter", "justifyright"] ] }); }); });
which works fine until add asp.net updatepanel - textarea inside updatepanel, , when page loads, loads plain textarea. used firebug step through , code run, not after updatepanel refreshes suspect.. removing updatepanel allows load jhtmlarea expected.
i tried calling same code function when display textarea, , formats jhtmlarea correctly, but, disabled how can't see when inspect page.
i'd appreciate around getting work inside updatepanel.
thanks
its issue partial postback doesn't invoke jquery event , need rebind jquery after postback.you need named function , pass endrequest
callback when browser relinquishes control demo()
gets called
function demo() { $("#<%=this.txtdigital.clientid%>").htmlarea({ toolbar: [ ["bold", "italic", "underline", "strikethrough"], ["increasefontsize", "decreasefontsize", "forecolor"], ["orderedlist", "unorderedlist", "superscript", "subscript"], ["indent", "outdent", "justifyleft", "justifycenter", "justifyright"] ] }); } $(document).ready(demo);
now add below script in aspx file after scriptmanager
<script type="text/javascript"> sys.webforms.pagerequestmanager.getinstance().add_endrequest(demo); </script>
Comments
Post a Comment