Sorry if this is too simple, I am new to programming and I stumbled upon this problem. How can I use the name attribute as the selector inside a $(document).on('click', '#thisisforid', function()..
?
It is well documented that I can use the id and class name by using #idname
and .classname
but it is nowhere to be found (I tried so hard to search) how to or if I could use the name attribute instead.
Use an Atrribute Selector like this:
$("[name = 'theNameYouWant']");
More CSS Selectors here.
Note: The CSS Selectors are not exclusive features of jQuery. They work everywhere (in CSS files, using document.querySelector
...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With