Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dynamic IDs. Checkbox (COMPARE)


OSC-Sevilla

Recommended Posts

On my products listing page i have the compare contribution.

 

As each product is returned a check box is added, see image.

 

This is the code:

 

$compare_checkbox_list ='<input type="checkbox" title="'.TEXT_COMPARE_CHECKBOX .'" name="checkgroup[]" id="checkgroup" value="'.$featured['products_id'].'"/>';

 

when validating the page you see this frequently:

 

 

to solve i want to either add render the id - id="checkgroup" with 1,2.3 etc.

 

presumably this can be done ion the above by some code and in the input id=\"checkgroup\"+i... or to that affect.

 

 

or by running a function to cange the universal id="checkgroup" by counting them and add 1,2,3.. etc at the end.

 

$(function(){

var i = 1;

var i = 1;

document.onload= function () {

$("<div />")

 

.append($("<input />", { type: "checkbox", id:"checkgroup"+i }))

.appendTo("#someContainer");

i++;

});

 

NEED SOME HELP - NOTING WORKING AND I HAVE NO IDEA.

Link to comment
Share on other sites

SOLVED:

 

Simple:

 

'<input type="checkbox" title="'.TEXT_COMPARE_CHECKBOX .'" name="checkgroup[]" id="'.('checkgroup'.$row++).'" value="'.$featured['products_id'].'"/>';

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...