Link to home
Start Free TrialLog in
Avatar of burnedfaceless

asked on

A ton of JavaScript questions

Here is the main JavaScript. I have comments I was hoping someone could answer the questions for me.

    <script src="js/jquery-1.10.2.js"></script> (i know this is Jquery even though I didn't label it in rates.php.)
    <!--bootstrap core JavaScript-->
    <script src="js/bootstrap.min.js"></script>
    <!--Jquery plugin-->
    <script src=""></script>
    <script src="js/classie.js"></script>
    <!--Affects the menu bar size and scrolling? Will have to alter it to retain full functionality on multiple pages?-->
    <script src="js/cbpAnimatedHeader.js"></script>
    <!--JavaScript for the freelancer template-->
    <script src="js/freelancer.js"></script>
    <!--Simple script to hide or display buttons-->
    <script src="js/rates.js"></script>

This is a small business and I'm going to use this starter template first. But I feel like I should understand the JavaScript to use it right. Apprecaite the help if they want me to I can beef it up later.

The file in question is rates.php. Thanks. Just whatever you all think I should understand I will learn what you think and any help would be appreciated.
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of burnedfaceless


That makes sense. I used to be better with CSS. Could I start there? I'm pretty familiar with HTML.

I will do the work you recommended. Is that more important than really going through the code?

I just realized I needed to change the class attributes with Jquery for form validation instead of the class name which I did with php and just had a set class name. I'm going to try to do this tonight with what I know and a little tomorrow. But I do intend to learn.

What do you think of this?

I take it you think I should run through that stuff again? Before really delving into the code? I couldn't get into the jquery stuff because some of it was so old but it sounds like there's a compiler that would really help.

I appreciate the answer and whatever you think I should do I'll do. I'm going to try to get something done tonight as well with what I know and examples I've been given on this site.
And I'm not trying to sound condescending. Jquery syntax is beyond me. I know that.
I will do your work. I have another job lined up and everyone knows how to look at html css and JavaScript. Clients care about presentation but others may look at other things.

Thanks for your help. This has been rewording work.
I really like the  codecademy site because the learning is interactive.  The site you showed me is just reading.  We all learn best differently and for me it is by example and practice.

I can tell you when I see people skip the basics and go right to coding to, 'save time' they end up wasting a lot more time in the end and become frustrated.  We have all been there.   I know it is not easy to stop, take a break and learn.  But in the end it will save you a lot of time.    

I have seen some Askers here where I have given the same advice and they 'don't have time' but I see them back several months later with a mess of code and more confused for something that would have taken a few days to do, once you spent a week learning.  I would say 2 weeks is faster than 3 months.  Then next time it will just be several days.

Best of luck on your project!
Thanks for the encouragement and the site. I'm working on jQuery. Kind of backwards it's just so different. And the syntax. I've done C languages and that syntax but this is different.

I'll go back and do more work on html and css. Very cool resource.

Wanted to come back and thank you for that resource. Amazing.
Your welcome.  

Jquery is tied pretty closing to css.

If you have, <div class="results">Stuff</div> and you want to trigger something when the word Stuff is hover you could do something like

           // do something

For people that are in bad habits like using multiple ID's on the same page or using inline css  <div style="background-color:red;">Stuff</div> will be in trouble with this.  

There is too much go to over here, that is why it is good to make sure you know the basics first before jumping in.  

Also get to know your browsers console. Chrome, Firefox, Safari and IE all have a console you can use to peak  under the hood.  That will help you understand what is going on.
Yea I have multiple IDs on the whatever. I haven't gone through the stuff and don't know if changing them to classes will affect functionality i'm sure I'd have to change the bootstrap stuff somehow so I agree.

jQuery is just different. I can't articulate it yet. Syntax wise something seems to be very different from C languages; except it has built in functions like PHP. I am imagining it interacts with PHP quite well and does some amazing things. It's fun.

I'll check that out because honestly I wasn't able to pay attention well when we started CSS and I should be so much better at it. The JavaScript that was just a C language and I blew through that stuff easy. They let us do it as our foreign language at Alabama. It was cool.

I agree with what you're saying. I need to review html work through the css.

Do you have an opinion on templates? I mean even if you destroy them?

I made one page where I had a vision of css and html it didn't validate either I kind of just got lucky but even that I was using colors and background images. Kind of tricky to be tasteful choose the right colors and whatnot.
>They let us do it as our foreign language at Alabama
That's awesome!  

jquery is javascript.  Some people don't like using it because it adds extra weight.  For very basic items, that may be true but jquery is used all over and especially when you get into responsive designs .

<div id="results" class="xyz" data-something="123"><strong>Stuff</strong></stuff>
[b]Pure JS[/b]
element = document.getElementById("results");  //Stuff
element = $('#results').html():   // <strong>Stuff</strong>
element = $('#results').text():   //  Stuff
element = $('.xyz').text():   //  Stuff
element = $('.xyz').prop('data-something'):   //  123
$('.xyz').html('<div class="red">New</div>');  // converts <strong>Stuff</strong> to <div class="red">New</div>

Open in new window

>I am imagining it interacts with PHP quite well
Remember that PHP like .NET or Classic ASP runs on the server.  Javascript and Jquery run on the client.  The two can't talk to either other although you can use PHP to render javascript or jquery and that js will run once the page loads.   The code below will run on the server, php will render the js code to the page, when the page loads you will get an alert.  So PHP can write out javascript but the two don't "touch".

echo '<script>alert("Hello");</script>'

Open in new window

If you like javascript, check out some

Have fun...
I have book marked the page you gave me. I think of it as more dynamic it's also less work once you learn it. Very cool.

Am I mistaken in thinking that the functions are different. The way they really just keep leaning into each other. Different from JavaScript or am I confused?
I see what you're saying. It is a lot to take in at first but it really opens doors.