I Can Not Use Jquery Properly In My Project.

Hi Everyone.

I am getting problem with using jquery.

I have made a separate javascript file for all the project. My project folder name is ‘main_project’ and js file path is ‘/main_project/js/layout.js’.

whenever I write code in following format the code is working for any module and it’s view.

function delete_row(id) {

$('#record_row' + id).remove();


but when I write the code in following format It’s not working even I think it is not detecting the html element for any modules view.

$(document).ready(function() {

$('#record_row' + id).remove();


For executing my code in this format. I am writing this code in my every view file under modules everywhere. But It’s creating problems now.

I have tried every possible way to execute these scripts with a single separate file. But it did not work till now.

I must have to use jquery scripts in a separate file to prevent unobtrusive java script problems.

Note: These code’s are just a example actual codes are different.


Abhay Gupta,

can you post your original code and see if you getting any javascript errors in your browser console.

There is a big difference on yur two examples… the first example is a function, that to be executed needs to be called form some other code…

The second example is executed only once when the document is ready, it’s NOT a function and cannot be called like the first example.