Hello,
I use ajax to return html code and append it to a div layer:
$(div_layer).append(ajax_value);
ex:
<br/>
<div id="divName"><br/>
--value appears here--<br/>
</div >
I can successfully append the code to the div layer, but the css attributes are lost ONLY in IE. eg: border-color, border-width.
help me out, thanks
edit: ajax function
function ajaxFuntion(){
var ajaxRequest;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// step 3: append ajax value to #divLayer
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajax_value = ajaxRequest.responseText;
$("#divlayer").append(ajax_value);
}
}
//step 1: get query values from textarea
var code = $('#textareaID').val();
var query = "?CODE=" + code;
//step 2: send query to php file
ajaxRequest_c.open("GET", "target-php-file.php" + queryString, true);
ajaxRequest_c.send(null);
};
this is what the php file returns upon getting the query values:
$increment = $count + 1;
echo "<span class='items' id='div-".$increment."'>
<div class='dragbox' id='item1' >
<input type='hidden' id='items-drag-name-".$get_id_r['ID']."' value='".$get_id_r['ELEMENT']."'/>
<h3 id='snp-title-".$increment."' style='float:left;margin:4px 0 0 0'>";
echo $name;
echo "</h3>
<a class='promptBox-delete-snippet RIGHT BTN-gray itemControl' id='".$increment."-".$get_id_r['CE_TABLE']."' href='#'><img class='XBUTTON' src='xbutton.png'/></a>
<a class='promptBox-addToEditor NSfunc RIGHT BTN-gray itemControl' id='add-".$get_id_r['ID']."' href='#'>+</a>
<a class='promptBox-edit-snippet NSfunc RIGHT BTN-gray itemControl' id='".$get_id_r['ID']."' href='#'>E</a>
<br clear='all'/>
<div class='promptBox' id='div-".$get_id_r['ID']."' style='display:none;'>
<h2 id='promptBox-caption'>Edit Snippet <a class='close-promptBox' id='edit-snippet-close' href='#'>[x]</a><br clear='right'/></h2>
<div id='promptBox-content'>
Snippet title:
<input class='promptBox-name' type='text' id='snippet-name-".$get_id_r['ID']."' value='".$get_id_r['ELEMENT']."'/><br/>
<input type='hidden' id='snippet-name-backup-".$get_id_r['ID']."' value='".$get_id_r['ELEMENT']."'/>
<br/>
Code:
<textarea class='promptBox-text' id='snippetCode-textarea-".$get_id_r['ID']."'>".$get_id_r['DEFAULT_CONTENT']."</textarea>
<input type='hidden' id='snippetCode-textarea-backup-".$get_id_r['ID']."' value='".$get_id_r['DEFAULT_CONTENT']."'>
</div>
<a class='promptUpdate EDIT' id='is-".$get_id_r['ID']."' href='#'>Update</a><br clear='right'/>
</div>
</div>
</span>";
echo "==>".$increment;