` Every time the loops go through i ...">

Javascript multiple values on the same ID

I have a loop in php that echos out a `` Every time the loops go through i get a new value in the hidden input field as you can understand. Now, im trying to grab the value from each of these items and get grab it with Javascript and SAJAX. The javascript im using now works, But! It only grabs the first value (because the ID is the same on each input) Javscript: function Showbooking() { id = document.getElementById('lol').value; x_showBookingForm(id, do_showBookingForm); } function do_showBookingForm(html) { openPopup(600, 550, html); } As you can see im opening a POPUP with javascript aswell and exports the value into that popup window. So on every popup I get the same value (the value from the first input). How Do I get around this problem?
The "id" attribute must be unique on the page if it exists at all. That is, you can't share "id" values. You can use the "class" attribute if you want the effect of "categorizing" elements.

以上就是Javascript multiple values on the same ID的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准