I'm trying to maintain someone else's program and of course things are done differently that I'm used to.
I've played with this for many days without success so I thought I would post here.
I have a web page with a <form and that form contains a table where each column is defined as "contenteditable=yes".
I'm trying to embed a javascript color picker (jscolor.js) into this field which I have working but the field update does not work.
Below is an html snippet for this column:
<td id="contact_color:<?=$status_id?>" contenteditable="true">
<input class="jscolor { closable:true,closeText:'Select!' }" value="<?=$contact_color?>" data-id="contact_color:<?=$status_id?>" />
</td>
and here is the javascript function that supposedly updates this:
<script>
// *****************************************************************
// acknowledgement message
$(function() {
var message_status = $("#status");
$("td[contenteditable=true]").blur(function(){
var field_userid = $(this).attr("id");
var value = $(this).text();
$.post('category-admin-update.php',field_userid + "=" + value,
function(data) {
if (data != '') {
message_status.show();
message_status.text(data);
//hide the message
setTimeout(function(){message_status.hide()},15000);
}
});
});
});
// *****************************************************************
</script>
Also be aware that I am not a good js person. I dabble a little or use public scripts.
So, any help, guidance, ideas, suggestions greatly appreciated.
Thanks
I've played with this for many days without success so I thought I would post here.
I have a web page with a <form and that form contains a table where each column is defined as "contenteditable=yes".
I'm trying to embed a javascript color picker (jscolor.js) into this field which I have working but the field update does not work.
Below is an html snippet for this column:
<td id="contact_color:<?=$status_id?>" contenteditable="true">
<input class="jscolor { closable:true,closeText:'Select!' }" value="<?=$contact_color?>" data-id="contact_color:<?=$status_id?>" />
</td>
and here is the javascript function that supposedly updates this:
<script>
// *****************************************************************
// acknowledgement message
$(function() {
var message_status = $("#status");
$("td[contenteditable=true]").blur(function(){
var field_userid = $(this).attr("id");
var value = $(this).text();
$.post('category-admin-update.php',field_userid + "=" + value,
function(data) {
if (data != '') {
message_status.show();
message_status.text(data);
//hide the message
setTimeout(function(){message_status.hide()},15000);
}
});
});
});
// *****************************************************************
</script>
Also be aware that I am not a good js person. I dabble a little or use public scripts.
So, any help, guidance, ideas, suggestions greatly appreciated.
Thanks