jQuery Event Keypress: Enter key

i have a combo box which has got values and i want to give the user to select the values when the Enter key pressed. User can navigate through Arrow key Select the value when user enters Enter key. I have done this one : $(‘#cmb_CIMtrek_DailyshipCo_CustomerName select’).bind(‘keypress’, function(e) { var code = (e.keyCode ? e.keyCode […]

Image hyperlink position

I’m not sure if this is possible or not. Is there a way to put a hyperlink on a specific coordinate on a image? Ex _____________________________________ | | | xxx | | xxx | | | | | | | | zzz | | zzz | | | |___________________________________| Is there a way to set […]

How to resize html pages on mobile phones

I am new to HTML and CSS development, I have created a html which looks fine on PC web browser. However, when I use my Android cell phone browser to view it, since the cell phone screen is too small, there will be a lot of sliding needs to be done by the cell phone […]

how to add text to span jquery

I have this jquery code that I am using to create a dynamic menu function createList(test){ alert(test); $(‘#nav’) .append(‘<li class=”top”><a href=”nogo2″ id=”products” class=”top_link”><span class=”down”></span></a></li>’); $(‘.down’).text(test); } the problem that i have is when i try to add the text to the span $(‘.down’).text(test); the menu changes to whatever value is the last for example if […]

How to get the value of data attribute using jquery

I am working on a node.js application which generates a html page. This html page displays a list of associates built according to the data passed onto this page. A list is built something like as follows: <ul class=”notification-body” style=””> //loop for all assocaite id’s passed to this page <li class=”testClass” data-associateid=”<%= assocID %>”> <span> […]

Why does this javascript run locally but not on a web server?

I have the following Javascript/jQuery on my page: <script> $(“#mymarkdown”).load(“./LPInfo.md”); var md = markdown.toHTML($(“#mymarkdown”).html()); $(“#mymarkdown”).html(md); </script> That page is here: http://www.nickhodges.com/LeanTed/bootstrap/about.html The page uses bootstrap. I’ve looked and see no errors in the console when rendering the code. As you can see, it is not doing what I want, which is using markdown.js to render […]

Ruby on Rails View inserting js.erb file via render

For including a piece of javascript that I only need on some pages, I put = javascript_tag do = render “inserts_js_enhanced_element.js.erb” in my haml file. Now I get the warning in my tests: DEPRECATION WARNING: Passing a template handler in the template name is deprecated. You can simply remove the handler name or pass render […]

Having a jQuery .click() event only fire once when inside another .click() event

If I have a jQuery .click() event firing for both “body” and a “div”, how would I get it to only execute for the div and not the body when the div is clicked? Basically, I’m making my own context menu and I want clicking anywhere outside the element (in this case, “div.button”) to close […]

How to call a Controller method from javascript in MVC3?

Im using MVC3 architecture, c#.net. I need to compare text box content(User ID) with the database immediately when focus changes to the next field i.e., Password field. So I thought to use onblur event to the User Id field which then calls the Controller method. Can any tell me how to approach to this problem? […]

jQuery select change event

I am trying to fire an alert depending on which value is selected from a <select> element using jQuery: $(“#optiontype”).change( function () { var option = $(“#optiontype”).val(); if(option.Contains(“Forward”)){ alert(“forward selected”); } }); The alert never fires whenever I choose ‘forward’ from the <select> element.