[jQuery] Re: New to JS and jQuery
Ahhh! Sorry, my bad, works now! Thanks. On Jan 6, 1:56 am, MorningZ wrote: > > I have $('.baritem').. > > No, no you don't right now on the URL > > http://ferok.com/labs/test.html > > and the included js file > > http://ferok.com/labs/global.js > > you have > > $('baritem').click(function() > > i just copied and pasted that right from the JavaScript include file > just like i did on my last post :-) > > fix the selector and then go from there > > As > > > > > said, Im new to jQuery so I don't know.. All I wanna do is having this > > script being able to "pop up" (like on facebook) more than just 1 box > > (Depending on which button you click, like: IF you click on a button > > with ID of "menu" it opens "menu_menu" if you click "stuff" if opens > > "menu_stuff" etc.. and I cant set it to just 1 ID cause then this wont > > work "dynamicly" eg. I wont be able to run more than just 1 box with > > this script as I cant set all the buttons to the same ID? > > > Brian got the idea, just that the script doesn't work. > > > On Jan 5, 9:14 pm, MorningZ wrote: > > > > You should pay attention to your selectors :) > > > > you have > > > > $('baritem').click(function() > > > > that looks for DOM objects > > > > but > > > > $('#baritem').click(function() > > > > will find > > > > On Jan 5, 2:41 pm, Valerij wrote: > > > > > This still wont work.. I've even tried copy your example character by > > > > character and it still gives nothing.. > > > > I'm using this code onhttp://ferok.com/labs/test.htmlatthebottom > > > > bar, try clicking the "My Account" and the menu wont "pop up". I had > > > > this working before, but I didn't have this dynamic code which I can > > > > use to open more than just 1 "tab". > > > > > The CSS: > > > > #stuff_menu {background-color:#E8E8E8;border: 1px solid #66;bottom: > > > > 22px;display:none;left:0px;padding:5px 5px 1px 5px;position: > > > > absolute;width:200px;} > > > > > On Jan 5, 5:03 pm, brian wrote: > > > > > > That works for me but I do see how this can be refactored: > > > > > > My Account > > > > > > > > > > > My Account > > > > > More stuff > > > > > Here is a menu item > > > > > Here is a menu item > > > > > Here is a menu item > > > > > Here is a menu item > > > > > > > > > > > Notice that I've changed the IDs so that the DIV has the link ID plus > > > > > some other string, rather than the other way around. > > > > > > Also, I've added a class to the DIV to make it easier to set styles. > > > > > This isn't strictly necessary. > > > > > > $(function() > > > > > { > > > > > /* set up the onclick handler for all links on page load > > > > > */ > > > > > $('.baritem').click(function() > > > > > { > > > > > $('#' + this.id + '_menu').toggle(); > > > > > return false; > > > > > }); > > > > > > }); > > > > > On Mon, Jan 4, 2010 at 4:01 PM, Valerij wrote: > > > > > > Hey guys, I'm trying to create 1 really simple function but it just > > > > > > doesn't work! > > > > > > > function showMenu(menu) { > > > > > > var menuid = $( "#"+menu ); > > > > > > var menuRoot = $( "#"+menu+"-root" ); > > > > > > > menuid.toggle(); > > > > > > menuRoot.blur(); > > > > > > } > > > > > > > What this suppose to do is when you click a link, it will change > > > > > > settings of a specific div to "visible" > > > > > > The HTML: > > > > > > > > > > > > onclick="showMenu('stuff');">My Account > > > > > > > > > > > > My Account > > > > > > More stuff > > > > > > Here is a menu item > > > > > > Here is a menu item > > > > > > Here is a menu item > > > > > > Here is a menu item > > > > > > > > > > > > > Why doesn't this work? What am I doing wrong.. When I alert this, I > > > > > > get the correct div ids?
[jQuery] Re: New to JS and jQuery
> I have $('.baritem').. No, no you don't right now on the URL http://ferok.com/labs/test.html and the included js file http://ferok.com/labs/global.js you have $('baritem').click(function() i just copied and pasted that right from the JavaScript include file just like i did on my last post :-) fix the selector and then go from there As > said, Im new to jQuery so I don't know.. All I wanna do is having this > script being able to "pop up" (like on facebook) more than just 1 box > (Depending on which button you click, like: IF you click on a button > with ID of "menu" it opens "menu_menu" if you click "stuff" if opens > "menu_stuff" etc.. and I cant set it to just 1 ID cause then this wont > work "dynamicly" eg. I wont be able to run more than just 1 box with > this script as I cant set all the buttons to the same ID? > > Brian got the idea, just that the script doesn't work. > > On Jan 5, 9:14 pm, MorningZ wrote: > > > You should pay attention to your selectors :) > > > you have > > > $('baritem').click(function() > > > that looks for DOM objects > > > but > > > $('#baritem').click(function() > > > will find > > > On Jan 5, 2:41 pm, Valerij wrote: > > > > This still wont work.. I've even tried copy your example character by > > > character and it still gives nothing.. > > > I'm using this code onhttp://ferok.com/labs/test.htmlatthebottom > > > bar, try clicking the "My Account" and the menu wont "pop up". I had > > > this working before, but I didn't have this dynamic code which I can > > > use to open more than just 1 "tab". > > > > The CSS: > > > #stuff_menu {background-color:#E8E8E8;border: 1px solid #66;bottom: > > > 22px;display:none;left:0px;padding:5px 5px 1px 5px;position: > > > absolute;width:200px;} > > > > On Jan 5, 5:03 pm, brian wrote: > > > > > That works for me but I do see how this can be refactored: > > > > > My Account > > > > > > > > > My Account > > > > More stuff > > > > Here is a menu item > > > > Here is a menu item > > > > Here is a menu item > > > > Here is a menu item > > > > > > > > > Notice that I've changed the IDs so that the DIV has the link ID plus > > > > some other string, rather than the other way around. > > > > > Also, I've added a class to the DIV to make it easier to set styles. > > > > This isn't strictly necessary. > > > > > $(function() > > > > { > > > > /* set up the onclick handler for all links on page load > > > > */ > > > > $('.baritem').click(function() > > > > { > > > > $('#' + this.id + '_menu').toggle(); > > > > return false; > > > > }); > > > > > }); > > > > On Mon, Jan 4, 2010 at 4:01 PM, Valerij wrote: > > > > > Hey guys, I'm trying to create 1 really simple function but it just > > > > > doesn't work! > > > > > > function showMenu(menu) { > > > > > var menuid = $( "#"+menu ); > > > > > var menuRoot = $( "#"+menu+"-root" ); > > > > > > menuid.toggle(); > > > > > menuRoot.blur(); > > > > > } > > > > > > What this suppose to do is when you click a link, it will change > > > > > settings of a specific div to "visible" > > > > > The HTML: > > > > > > > > > > onclick="showMenu('stuff');">My Account > > > > > > > > > > My Account > > > > > More stuff > > > > > Here is a menu item > > > > > Here is a menu item > > > > > Here is a menu item > > > > > Here is a menu item > > > > > > > > > > > Why doesn't this work? What am I doing wrong.. When I alert this, I > > > > > get the correct div ids?
[jQuery] Re: New to JS and jQuery
I have $('.baritem').. I thought that was to find class .baritem? As said, Im new to jQuery so I don't know.. All I wanna do is having this script being able to "pop up" (like on facebook) more than just 1 box (Depending on which button you click, like: IF you click on a button with ID of "menu" it opens "menu_menu" if you click "stuff" if opens "menu_stuff" etc.. and I cant set it to just 1 ID cause then this wont work "dynamicly" eg. I wont be able to run more than just 1 box with this script as I cant set all the buttons to the same ID? Brian got the idea, just that the script doesn't work. On Jan 5, 9:14 pm, MorningZ wrote: > You should pay attention to your selectors :) > > you have > > $('baritem').click(function() > > that looks for DOM objects > > but > > $('#baritem').click(function() > > will find > > On Jan 5, 2:41 pm, Valerij wrote: > > > > > This still wont work.. I've even tried copy your example character by > > character and it still gives nothing.. > > I'm using this code onhttp://ferok.com/labs/test.htmlatthe bottom > > bar, try clicking the "My Account" and the menu wont "pop up". I had > > this working before, but I didn't have this dynamic code which I can > > use to open more than just 1 "tab". > > > The CSS: > > #stuff_menu {background-color:#E8E8E8;border: 1px solid #66;bottom: > > 22px;display:none;left:0px;padding:5px 5px 1px 5px;position: > > absolute;width:200px;} > > > On Jan 5, 5:03 pm, brian wrote: > > > > That works for me but I do see how this can be refactored: > > > > My Account > > > > > > > My Account > > > More stuff > > > Here is a menu item > > > Here is a menu item > > > Here is a menu item > > > Here is a menu item > > > > > > > Notice that I've changed the IDs so that the DIV has the link ID plus > > > some other string, rather than the other way around. > > > > Also, I've added a class to the DIV to make it easier to set styles. > > > This isn't strictly necessary. > > > > $(function() > > > { > > > /* set up the onclick handler for all links on page load > > > */ > > > $('.baritem').click(function() > > > { > > > $('#' + this.id + '_menu').toggle(); > > > return false; > > > }); > > > > }); > > > On Mon, Jan 4, 2010 at 4:01 PM, Valerij wrote: > > > > Hey guys, I'm trying to create 1 really simple function but it just > > > > doesn't work! > > > > > function showMenu(menu) { > > > > var menuid = $( "#"+menu ); > > > > var menuRoot = $( "#"+menu+"-root" ); > > > > > menuid.toggle(); > > > > menuRoot.blur(); > > > > } > > > > > What this suppose to do is when you click a link, it will change > > > > settings of a specific div to "visible" > > > > The HTML: > > > > > > > > onclick="showMenu('stuff');">My Account > > > > > > > > My Account > > > > More stuff > > > > Here is a menu item > > > > Here is a menu item > > > > Here is a menu item > > > > Here is a menu item > > > > > > > > > Why doesn't this work? What am I doing wrong.. When I alert this, I > > > > get the correct div ids?
[jQuery] Re: New to JS and jQuery
You should pay attention to your selectors :) you have $('baritem').click(function() that looks for DOM objects but $('#baritem').click(function() will find On Jan 5, 2:41 pm, Valerij wrote: > This still wont work.. I've even tried copy your example character by > character and it still gives nothing.. > I'm using this code onhttp://ferok.com/labs/test.htmlat the bottom > bar, try clicking the "My Account" and the menu wont "pop up". I had > this working before, but I didn't have this dynamic code which I can > use to open more than just 1 "tab". > > The CSS: > #stuff_menu {background-color:#E8E8E8;border: 1px solid #66;bottom: > 22px;display:none;left:0px;padding:5px 5px 1px 5px;position: > absolute;width:200px;} > > On Jan 5, 5:03 pm, brian wrote: > > > That works for me but I do see how this can be refactored: > > > My Account > > > > > My Account > > More stuff > > Here is a menu item > > Here is a menu item > > Here is a menu item > > Here is a menu item > > > > > Notice that I've changed the IDs so that the DIV has the link ID plus > > some other string, rather than the other way around. > > > Also, I've added a class to the DIV to make it easier to set styles. > > This isn't strictly necessary. > > > $(function() > > { > > /* set up the onclick handler for all links on page load > > */ > > $('.baritem').click(function() > > { > > $('#' + this.id + '_menu').toggle(); > > return false; > > }); > > > }); > > On Mon, Jan 4, 2010 at 4:01 PM, Valerij wrote: > > > Hey guys, I'm trying to create 1 really simple function but it just > > > doesn't work! > > > > function showMenu(menu) { > > > var menuid = $( "#"+menu ); > > > var menuRoot = $( "#"+menu+"-root" ); > > > > menuid.toggle(); > > > menuRoot.blur(); > > > } > > > > What this suppose to do is when you click a link, it will change > > > settings of a specific div to "visible" > > > The HTML: > > > > > > onclick="showMenu('stuff');">My Account > > > > > > My Account > > > More stuff > > > Here is a menu item > > > Here is a menu item > > > Here is a menu item > > > Here is a menu item > > > > > > > Why doesn't this work? What am I doing wrong.. When I alert this, I > > > get the correct div ids?
[jQuery] Re: New to JS and jQuery
This still wont work.. I've even tried copy your example character by character and it still gives nothing.. I'm using this code on http://ferok.com/labs/test.html at the bottom bar, try clicking the "My Account" and the menu wont "pop up". I had this working before, but I didn't have this dynamic code which I can use to open more than just 1 "tab". The CSS: #stuff_menu {background-color:#E8E8E8;border: 1px solid #66;bottom: 22px;display:none;left:0px;padding:5px 5px 1px 5px;position: absolute;width:200px;} On Jan 5, 5:03 pm, brian wrote: > That works for me but I do see how this can be refactored: > > My Account > > > My Account > More stuff > Here is a menu item > Here is a menu item > Here is a menu item > Here is a menu item > > > Notice that I've changed the IDs so that the DIV has the link ID plus > some other string, rather than the other way around. > > Also, I've added a class to the DIV to make it easier to set styles. > This isn't strictly necessary. > > $(function() > { > /* set up the onclick handler for all links on page load > */ > $('.baritem').click(function() > { > $('#' + this.id + '_menu').toggle(); > return false; > }); > > > > }); > On Mon, Jan 4, 2010 at 4:01 PM, Valerij wrote: > > Hey guys, I'm trying to create 1 really simple function but it just > > doesn't work! > > > function showMenu(menu) { > > var menuid = $( "#"+menu ); > > var menuRoot = $( "#"+menu+"-root" ); > > > menuid.toggle(); > > menuRoot.blur(); > > } > > > What this suppose to do is when you click a link, it will change > > settings of a specific div to "visible" > > The HTML: > > > > onclick="showMenu('stuff');">My Account > > > > My Account > > More stuff > > Here is a menu item > > Here is a menu item > > Here is a menu item > > Here is a menu item > > > > > Why doesn't this work? What am I doing wrong.. When I alert this, I > > get the correct div ids?