Two id's for javascript function -


i have javascript function goes this:

function change_one() { var 1 = document.getelementbyid("one").value;  document.getelementbyid("tag").value=one; } 

it works fine until there 2 elements same id.

i'm using php fetch stuff mysql , while it's looping thru, it's echoing input tags have same id value.

how javascript code apply of input tags have id equal "one"?

"it works fine until there 2 elements same id."

that's invalid. best solution change php code use classes, or way distinguish. may find helpful use javascript library find elements matching class.

edit: using jquery, tag , one classes:

function change_one() {     $(".tag").val($(".one").val()); } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -