Rich text column + jQuery keydown event
-
2012년 8월 2일 목요일 오전 12:00
I can't seem to figure this out; I have a multiple line rich text box column that doesn't recognise when I type text inside the box. I added this code inside content editor webpart but my keydown event doesn't work, I do not get the alert. I do get the first alert that shows me the text inside the content editor. Can anyone help me out with this? Thank you :)<script type="text/javascript"> $(document).ready(function(){ alert($("textarea[title='My textarea']").val()); $("textarea[title='My textarea']").keydown(function() { alert('Testing...'); }); }); </script>
모든 응답
-
2012년 8월 3일 금요일 오후 12:21중재자
-
2012년 8월 3일 금요일 오후 2:28Thank you for the follow up :)
-
2012년 8월 20일 월요일 오전 7:15중재자
Hi ,
I have a test using your code and find that you have missed one line of code ,you can change the code like this:
<script type="text/javascript" src="</script">http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
alert($("textarea[title='My textarea']").val());
$("textarea[title='My textarea']").keydown(function() {
alert('Testing...');
});
});
</script>Thanks,
Entan Ming
Entan Ming
TechNet Community Support
-
2012년 8월 20일 월요일 오후 6:55
I tried using your code and it doesn't work with rich text, the code only works with plain text.
Thank you!
-
2012년 8월 21일 화요일 오전 1:57중재자
Hi ,
When it comes to rich text of multiple line of text field, you need to change the code like this :
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var a=$("#ctl00_ctl24_g_033a4807_6c5f_4280_90ae_f6874e868b83_ctl00_ctl05_ctl03_ctl00_ctl00_ctl04_ctl00_ctl00_TextField_spSave").val();
alert(a);
$("#ctl00_ctl24_g_033a4807_6c5f_4280_90ae_f6874e868b83_ctl00_ctl05_ctl03_ctl00_ctl00_ctl04_ctl00_ctl00_ TextField_spSave ").keydown(function() {
alert('Testing...');
});
});
</script>
The id in the code can be get using IE developer tool.Open the page new form in browser and press F12 to open developer tool. Use the arrow to select the rich text box. Find the id which contains ‘TextField_spSave’ and ‘TextField_spSave’ and replace the id above.
Thanks,
Entan Ming
Entan Ming
TechNet Community Support
- 답변으로 표시됨 Dranium 2012년 8월 28일 화요일 오전 1:09
-
2012년 8월 23일 목요일 오전 10:06
- 답변으로 제안됨 Selva R 2012년 8월 23일 목요일 오전 10:06

