frankcollins3 / ASPokedex

Pokedex with ASP backend / razor pages, and VanillaJS front end
1 stars 0 forks source link

dynamically update UI [6:33am] #18

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

attempting to do: set ID to be index of the loop add data to DB. do a test by deleting the

  • @PokemonModel.name
  • which comes from PokeAPI test changing $('#elem').textContent with text delivered from the database instead. Screen Shot 2023-09-22 at 6 26 07 AM

    error: Screen Shot 2023-09-22 at 6 25 49 AM

    proposed approach: 1: @ is in the wrong spot it seems.

    // forgot to include that the main doing right now is setting id to be index of loop. 2: change the index to precede the descriptive text in the id

    3: another proposed approach would be to isolate the CSS files. Set id to be index only. // this method would have to separate concerns for later data-loops that would attempt the same since: they'd have the same id (which might not be a problem because the styling might be similar but worth mentioning)

    possible improvements:

    frankcollins3 commented 1 year ago

    👎 @[i] Screen Shot 2023-09-22 at 6 38 13 AM [6:38am]

    frankcollins3 commented 1 year ago

    this attempt brings about the question: is @ a reserved keyword conventionally? whether by community concensus or by error? [6:42am]

    frankcollins3 commented 1 year ago

    also we can of course do $('elem').Siblings() but would rather use C# than JQ during this // both attempts utilize JQ and C# but want to target the element with the @ [6:49am]

    frankcollins3 commented 1 year ago

    chatGPT proposed solution: Screen Shot 2023-09-22 at 6 51 49 AM

    Screen Shot 2023-09-22 at 6 52 23 AM

    Screen Shot 2023-09-22 at 6 52 19 AM

    error: trying to send 2nd arg @i through onclick params but if ID is properly set: regex the int id from string .replace() [6:53am]

    frankcollins3 commented 1 year ago

    code: Screen Shot 2023-09-22 at 7 17 24 AM Screen Shot 2023-09-22 at 7 17 33 AM

    output: Screen Shot 2023-09-22 at 7 17 47 AM

    Screen Shot 2023-09-22 at 7 17 49 AM [7:18am]