Need javascript function help inside js file

Need javascript function help inside .js file

I need to modify or fix the output of a function.

so here it is: -----------

this is where it outputs my variable:

<p class="pp_description"></p>

(displays a variable)

this is the one part of the large code(modifies or creates the variable ):

if(pp_descriptions[set_position]!=""){$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));}else{$pp_pic_holder.find('.pp_description').hide();}

The output that i need to change(or just add something to it): html(unescape(pp_descriptions[set_position])); (how do i modify it to get the output like I need.)

I need to get the output to be like

<input value="$the_output" type="text">

instead of

<p class="pp_description">$the_output</p>

How can I get what I want:D?

----my knowledge about js—
Tried like adding “things” to it but the html() function outputs the first value, so I need a solution, add something to the function, I never have written javascript myself, so I guess it’s easy to people who know javascript more.

Thank you!

What you currently have is:


if (pp_descriptions[set_position]!="") {
    $pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
} else {
    $pp_pic_holder.find('.pp_description').hide();
}

The part that we’re interested in is:

$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));

So instead of setting the HTML content, you want to set an attribute called value instead:


$pp_pic_holder.find('.pp_description').show().attr('value', unescape(pp_descriptions[set_position]));

Thank you for the answer! issue solved.