Scritik / prestui

UI library for PrestaShop modules
MIT License
44 stars 14 forks source link

Prefix is needed for attribute #4

Closed maniT4c closed 8 years ago

maniT4c commented 9 years ago

If we use id, name or class for target element the orginal element ( for exemple will be targeted.

Like this

$('.myinput') will target generated input AND the orginal element. It's worse with id (see my request) because jquery stop on first id founded.
Scritik commented 8 years ago

(yep, never too late :))

I don't think adding IDs inside PrestUI is a good idea. If you want to add an ID, it's better to have it on the riot tag, and then access the child you want:

$('#my-tag input[name=title]')

For the classes, this is the same. You are not supposed to customize the content of the tag. If you really need to, you can add an ID or a class on the riot tag and add your CSS/JS depending on that.

Finally, for the name, is it really such a big issue? When you want to access an element by its name, it's better to add the input type before, like in my previous element, no?