JavaScript unable to scroll context while using NicEdit
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am a novice coder so I am having trouble getting this to work.
I have a javascript that scrolls the content of a <textarea>
tag to bottom on button click, but when I add NicEdit plugin in it the script doesn't work.
I've already tried all the alternative ways to get it to work by creating external divs and wrappers but I'm sure it's coz of NicEdit.
Working Script Without NicEdit: http://jsfiddle.net/gab4qhc1
Not working script with NicEdit: http://jsfiddle.net/sgdLzjau
Kindly help me to get the script working along with nicedit.
Thanks
javascript html nicedit
add a comment |
I am a novice coder so I am having trouble getting this to work.
I have a javascript that scrolls the content of a <textarea>
tag to bottom on button click, but when I add NicEdit plugin in it the script doesn't work.
I've already tried all the alternative ways to get it to work by creating external divs and wrappers but I'm sure it's coz of NicEdit.
Working Script Without NicEdit: http://jsfiddle.net/gab4qhc1
Not working script with NicEdit: http://jsfiddle.net/sgdLzjau
Kindly help me to get the script working along with nicedit.
Thanks
javascript html nicedit
add a comment |
I am a novice coder so I am having trouble getting this to work.
I have a javascript that scrolls the content of a <textarea>
tag to bottom on button click, but when I add NicEdit plugin in it the script doesn't work.
I've already tried all the alternative ways to get it to work by creating external divs and wrappers but I'm sure it's coz of NicEdit.
Working Script Without NicEdit: http://jsfiddle.net/gab4qhc1
Not working script with NicEdit: http://jsfiddle.net/sgdLzjau
Kindly help me to get the script working along with nicedit.
Thanks
javascript html nicedit
I am a novice coder so I am having trouble getting this to work.
I have a javascript that scrolls the content of a <textarea>
tag to bottom on button click, but when I add NicEdit plugin in it the script doesn't work.
I've already tried all the alternative ways to get it to work by creating external divs and wrappers but I'm sure it's coz of NicEdit.
Working Script Without NicEdit: http://jsfiddle.net/gab4qhc1
Not working script with NicEdit: http://jsfiddle.net/sgdLzjau
Kindly help me to get the script working along with nicedit.
Thanks
javascript html nicedit
javascript html nicedit
asked Jan 4 at 4:45
Cody CodersonCody Coderson
17112
17112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
First of all, I would recommend you to use CKEditor
or TinyMCE
because nicEdit
is not in active development (http://nicedit.com/docs.php).
Let's come to the problem, There was an error in console bkLib.domLoad[i] is not a function
(I don't know what is bkLib
) so what I did is, I removed that function and removed JS code
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
from HTML file and added in the script file (I think it is good to separate JS and HTML code if possible) as following
HTML
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
<textarea id="textarea" cols=30 rows=5 >
Please presse enter Please presse enterPlease presse enter
Please presse enterPlease presse enterPlease presse enter
Please presse enterPlease presseenter
Please presse enterPlease presse enter
Please presse enter
</textarea>
<button id="button">click</button>
Script
$(document).ready(function(){
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
$("#button").click(function(){
var textArea = $('.nicEdit-main');/*replace #textarea with .nicEdit-main*/
textArea.scrollTop( textArea[0].scrollHeight - textArea.height() );
});
});
(Not need to modify CSS)
Why #textarea
selector is not working and .nicEdit-main
is working
So, the reason behind this is every HTML based text editor use there own wrapper instead of textarea
to make it more customizable like to apply bold
, italic
effects and in nicEdit
they use a div
with class nicEdit-main
.
I hope this will help you to solve your problem. Happy Coding... :)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54033237%2fjavascript-unable-to-scroll-textarea-context-while-using-nicedit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
First of all, I would recommend you to use CKEditor
or TinyMCE
because nicEdit
is not in active development (http://nicedit.com/docs.php).
Let's come to the problem, There was an error in console bkLib.domLoad[i] is not a function
(I don't know what is bkLib
) so what I did is, I removed that function and removed JS code
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
from HTML file and added in the script file (I think it is good to separate JS and HTML code if possible) as following
HTML
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
<textarea id="textarea" cols=30 rows=5 >
Please presse enter Please presse enterPlease presse enter
Please presse enterPlease presse enterPlease presse enter
Please presse enterPlease presseenter
Please presse enterPlease presse enter
Please presse enter
</textarea>
<button id="button">click</button>
Script
$(document).ready(function(){
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
$("#button").click(function(){
var textArea = $('.nicEdit-main');/*replace #textarea with .nicEdit-main*/
textArea.scrollTop( textArea[0].scrollHeight - textArea.height() );
});
});
(Not need to modify CSS)
Why #textarea
selector is not working and .nicEdit-main
is working
So, the reason behind this is every HTML based text editor use there own wrapper instead of textarea
to make it more customizable like to apply bold
, italic
effects and in nicEdit
they use a div
with class nicEdit-main
.
I hope this will help you to solve your problem. Happy Coding... :)
add a comment |
First of all, I would recommend you to use CKEditor
or TinyMCE
because nicEdit
is not in active development (http://nicedit.com/docs.php).
Let's come to the problem, There was an error in console bkLib.domLoad[i] is not a function
(I don't know what is bkLib
) so what I did is, I removed that function and removed JS code
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
from HTML file and added in the script file (I think it is good to separate JS and HTML code if possible) as following
HTML
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
<textarea id="textarea" cols=30 rows=5 >
Please presse enter Please presse enterPlease presse enter
Please presse enterPlease presse enterPlease presse enter
Please presse enterPlease presseenter
Please presse enterPlease presse enter
Please presse enter
</textarea>
<button id="button">click</button>
Script
$(document).ready(function(){
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
$("#button").click(function(){
var textArea = $('.nicEdit-main');/*replace #textarea with .nicEdit-main*/
textArea.scrollTop( textArea[0].scrollHeight - textArea.height() );
});
});
(Not need to modify CSS)
Why #textarea
selector is not working and .nicEdit-main
is working
So, the reason behind this is every HTML based text editor use there own wrapper instead of textarea
to make it more customizable like to apply bold
, italic
effects and in nicEdit
they use a div
with class nicEdit-main
.
I hope this will help you to solve your problem. Happy Coding... :)
add a comment |
First of all, I would recommend you to use CKEditor
or TinyMCE
because nicEdit
is not in active development (http://nicedit.com/docs.php).
Let's come to the problem, There was an error in console bkLib.domLoad[i] is not a function
(I don't know what is bkLib
) so what I did is, I removed that function and removed JS code
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
from HTML file and added in the script file (I think it is good to separate JS and HTML code if possible) as following
HTML
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
<textarea id="textarea" cols=30 rows=5 >
Please presse enter Please presse enterPlease presse enter
Please presse enterPlease presse enterPlease presse enter
Please presse enterPlease presseenter
Please presse enterPlease presse enter
Please presse enter
</textarea>
<button id="button">click</button>
Script
$(document).ready(function(){
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
$("#button").click(function(){
var textArea = $('.nicEdit-main');/*replace #textarea with .nicEdit-main*/
textArea.scrollTop( textArea[0].scrollHeight - textArea.height() );
});
});
(Not need to modify CSS)
Why #textarea
selector is not working and .nicEdit-main
is working
So, the reason behind this is every HTML based text editor use there own wrapper instead of textarea
to make it more customizable like to apply bold
, italic
effects and in nicEdit
they use a div
with class nicEdit-main
.
I hope this will help you to solve your problem. Happy Coding... :)
First of all, I would recommend you to use CKEditor
or TinyMCE
because nicEdit
is not in active development (http://nicedit.com/docs.php).
Let's come to the problem, There was an error in console bkLib.domLoad[i] is not a function
(I don't know what is bkLib
) so what I did is, I removed that function and removed JS code
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
from HTML file and added in the script file (I think it is good to separate JS and HTML code if possible) as following
HTML
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
<textarea id="textarea" cols=30 rows=5 >
Please presse enter Please presse enterPlease presse enter
Please presse enterPlease presse enterPlease presse enter
Please presse enterPlease presseenter
Please presse enterPlease presse enter
Please presse enter
</textarea>
<button id="button">click</button>
Script
$(document).ready(function(){
nicEditors.allTextAreas({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript']});
$("#button").click(function(){
var textArea = $('.nicEdit-main');/*replace #textarea with .nicEdit-main*/
textArea.scrollTop( textArea[0].scrollHeight - textArea.height() );
});
});
(Not need to modify CSS)
Why #textarea
selector is not working and .nicEdit-main
is working
So, the reason behind this is every HTML based text editor use there own wrapper instead of textarea
to make it more customizable like to apply bold
, italic
effects and in nicEdit
they use a div
with class nicEdit-main
.
I hope this will help you to solve your problem. Happy Coding... :)
edited Jan 4 at 5:31
answered Jan 4 at 5:23
Niraj KaushalNiraj Kaushal
825614
825614
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54033237%2fjavascript-unable-to-scroll-textarea-context-while-using-nicedit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown