Hi there,
I solve a problem with append the values into the value atribute of input.
If I click on some html element, I need this text of element put into the input as its value. The problem is that I don't know, how to put several values into the input.

I try it to solve so:

$("a.knowledge").live('click', function() {	
  val = $(this).html();
  $("div.new-pol2").append(val);
  $("input#frmfirstForm-specializace").append(val(val+';;'));
  $(this).remove();
});

I want the values puts into the input#frmfirstForm-specializace (the values are separated by ';;') -- but always I've in this input only one value, never several, on which a clicked... and I don't know, how to put in that input several values...

I will be very glad for every help, idea. Thanks.
Manny

To me, this doesn't look like you are appending value to the existing value but rather attempting to append the same attribute to the input tag... I don't use JQuery, so I am not sure the right way to fix this. If it is pure JavaScript, I could.

Manny,

I think you might want $("input#frmfirstForm-specializace").val($("input#frmfirstForm-specializace").val()+';;'+val)); .

It's a bit long-winded but give it a try.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.