jQuery(document).ready(function($) {
var devices = $(".menu-item-custom").map(function() {
return this.id.substr(10);
}).toArray();
$.each(devices, function() {
$("#menu-item-settings-"+this+" .description").eq(3).after("<p class='description description-thin'><label for 'translated_title_"+this+"_ar'>عربي<br><input type= 'text' class='widefat edit-menu-item-title' name='translated_title_"+this+"_ar value='"+$(document).write('ssss')+"' '></label></p>");
});
});
Using this code I’m trying to write into the value attribute, but this error appears:
Uncaught TypeError: Object [object Object] has no method 'write'
The error is that there’s no
writefunction on$(document)(which is not the same asdocument).But perhaps more to the point, you’re creating a string to pass to
.after. That’s no place to be writing to the document. The following will suffice, for creating a string:(assuming
'ssss'will in production code be a variable, otherwise there is of course no need for concatenation at all)