Hi Matt, thanks a lot.  That's great info - I think I'm starting to see 
what you guys are saying about jQuery.  And I didn't even know what DOM was 
until today but I think that advice makes sense too :)  I haven't seriously 
looked at HTML in ... gotta be 20 years, and never CSS or JavaScript.

I'll keep working on it!  Thanks for the help.


On Tuesday, December 3, 2019 at 11:08:06 AM UTC-5, mwall wrote:
>
>
>
> On Tuesday, December 3, 2019 at 10:04:09 AM UTC-5, Jared wrote:
>>
>>
>> I made a little JavaScript function (wind.js) that will update the 
>> Seasons *current_widget* table with wind values from CRT realtime.txt.  
>> The function works perfectly fine if I drop it into the browser console 
>> after the page loads, but for the life of me I cannot get this thing loaded 
>> by itself.  The console always shows the error *$ is not defined* in 
>> wind.js.  The errant line is *tbl = $('.widget_contents', 
>> $('current_widget'));* where I am grabbing the table object.
>>
>
> first of all, nice work so far!
>
> $ is used by jquery.  as far as i know it does nothing in pure javascript.
>
> http://xahlee.info/js/js_dollar_sign_in_javascript.html
>
>
> https://www.quora.com/Learning-programming-Why-would-a-JavaScript-variable-start-with-a-dollar-sign
>
> you probably want something like this:
>
> var tbl = document.getElementById('current_widget')
>
> then traverse the DOM from there to get the object you want.
>
> you might want to put an id on each DOM element that you want to modify - 
> then there is no need to traverse the DOM.  if you use the observation name 
> for each id then that makes it even easier.
>
> m 
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/6ef679d5-b590-4032-b280-3abade6fe0e7%40googlegroups.com.

Reply via email to