# Tag Info

## Hot answers tagged jquery

6

I would limit my review to db.php file only. First of all, I see you made use of some of my advises already, probably visited some of my articles. Sadly, not all recommendations are followed, but that's OK, we'll review them. Connection The connection part is simply OK, nothing to review Structure Regarding the structure, I would say this file is a bit ...

2

PHP Constants The first five variables in db.php could be declared as constants since they shouldn't be changed: define('DB_HOST', '127.0.0.1'); define('DB_USER', ''); define('DB_PASS, ''); define('DB_NAME, 'doodle'); define('DB_CHARSET', 'utf8mb4'); And notice the prefix DB_ was added to those names to specify that those values pertain to the database. ...

2

Don't repeat the queries. Store any queries that are called more than once in a variable, and utilize jQuery's chaining: const navbarNav = $( '#navbarNav' ); const htmlBody =$( 'html, body' ); navbarNav.on( 'show.bs.collapse', function() { htmlBody.addClass( 'noscroll' ); }).on( 'hide.bs.collapse', function() { htmlBody.removeClass( 'noscroll' ); }...

2

If you are just wanting to take the current input value and copy it to the first other input you find that begins with the same name... (Not sure this is what you are after, but...) <!-- using onClick(),or use addListener() if you prefer --> <input type="text" name="myName" value="abd" id=srcInput onClick="copyThis2That(this)"/> <input type=...

2

The whole thing could by simplified by adding to the HTML, for example using data attributes: <input type="text" name="price-0" data-copy-group="price"> $(document).on('click', '.--copy', function () { var input =$(this).closest('div').find('input'); var copyGroup = input.data('copy-group'); \$('input[data-copy-group=' + copyGroup + ']')....

Only top voted, non community-wiki answers of a minimum length are eligible