0

The problem I am encountering is that I want to be able to view the row variable without the waiting for event click.

Works: JQuery event waiting for click, row is view-able:

$('[data-row]').on('click', function() {
   var row = $(this).attr('data-row');
    alert(row); // 
}); 

Does not work: This is what I want to work...?:

$('[data-row]').(function() {
   var row = $(this).attr('data-row');
    alert(row); 
}); 
0

3 Answers 3

1

You are missing each

$('[data-row]').each(function() {
   var row = $(this).attr('data-row');
   alert(row); 
}); 
Sign up to request clarification or add additional context in comments.

Comments

0

Unclear. What does alert($row) have to do with deciding to load an HTML file?

You could use setTimeout function to avoid clicking.

Comments

0

Delete the line 1 and 4 of your 2nd code.
This must be inside of jquery document.ready
Your code must be like this

var row = $(this).attr('data-row');
alert(row); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.