I am a little desperate and I need the help of a generous person here!
I have been hired to do a difficult project, but I am only a PHP developer and I know very few about Javascript.
What I need to do is to create a function in Javascript that will be called by an external script ( I do not have this script, so I know only the params the script will pass to the function ). When the function has been called and the params have been passed to the function, this function will start writing some HTML, inside the blocks that the other script has already cloned.
So, the other script will clone the HTML blocks all the times that is necessary and will assign an ID in the object of the cloned HTML block. At this point my function, receives the ID of the cloned HTML block and will start writing inside the cloned block.
This is not clear for me.
This is the example of the code:
function showSubject(params) {
var targetElement = params.targetElement;
var subjectName = params.subjectName;
var numMentions = params.numMentions;
var numPositive = params.numPositive;
var numNegative = params.numNegative;
var imageSrc = params.imageSrc;
/* write the code in the HTML block */
return (true or false) //true if all is fine
};
Example of the params my function will get.
var params = {
candidatesObject: "cloned item",
candidateName: "Nome Cognome",
numMentions: 1000,
numPositive: 1000,
numInformative: 1000,
numNegativers: 1000 };
Can anyone give me a direction? An example? Something please... :(
{ a: 1, b: 2 }.targetElement?{key: value}or[value1, value2, ... value_n], and present your question more clearly as I'm having a little trouble understanding what exactly you need help with?