jquery-selectors

Find name of selected option using jQuery

I've made a jquery/ajax function that updates #courses, sending #fos's .val() and .text(), specifically of the one that is selected, like so: $('#selling #fos').change(function() { $.post('/ajax/courses', { fos_id: $('#selling #fos').val(), name: $('#selling #fos :selected').text() }, func...

How do I access style properties of pseudo-elements with jQuery?

For context, this is a followup to an earlier question. Rather than digging through cssRules, I'd like to base the logic on jQuery selectors that search for the effects of those rules. Given default properties of .commentarea .author:before { background-image: url(http://...); background-position: -9999px -9999px; /* ... */...

Add a dialog to the document root, jQuery

Hi, in this example the dialog is added to an #dialog-confirm element. But I want it to be added just to the body and I do not want any predefined div#dialog-confirm element in my html. So how do I realize that? ...

jQuery checkbox undo solution

<table> <tr> <td> <div> <input type="checkbox" id="home1">Home1</input> <input type="checkbox" id="home2">Home3</input> <input type="checkbox" id="home3">Home3</input> <input type="checkbox" id="home4">Home4</input> </div> </td> <td id="selectedhome"> </td> </tr> </table> <input type="button" value=...

Bind a key (for page transition with backspace) only if the key is NOT pressed in an input field?

Hi, i don't know why, but i got this already to work but today it stopped working. The base code is: $(document).bind("keydown", function(e){ if (e.keyCode) code = e.keyCode; // für alle Browser else if (e.which) code = e.which; // für ie if(code==8) { $("#outer-frame").fadeOut(400, function (){ //conten...

jquery checkbox properties

In the below code how to get the checkboxes that are selected only and remove it from the list using jquery and populate the removed html in the div <div id="section_val"> <input type="checkbox" name="a_d" value="1">a_d</input> <input type="checkbox" name="a_d" value="2">a_d1</input> <input type="checkbox" name="a_d"...

Jquery remove selected div

<div id="a_all"> <div>&nbsp;&nbsp;&nbsp;&nbsp<input type="checkbox" name="m_a">1</input<br></div> <div>&nbsp;&nbsp;&nbsp;&nbsp<input type="checkbox" name="m_a">2</input<br></div> <div>&nbsp;&nbsp;&nbsp;&nbsp<input type="checkbox" name="m_a">3</input<br></div> <div>&nbsp;&nbsp;&nbsp;&nbsp<input type="checkbox" name="m_a">4</inpu...

Passing a self object in jquery

In the below code how to pass the div object inside validate function <div><input type="text"></input>&nbsp;&nbsp;&nbsp&nbsp;<a href="#" onclick="validate("Hot to pass the div objevt here")"</input> <script> function validate() { ..... ..... Finally remove the div } </script> ...

Help with jquery selecting correct element

I have the following HTML: <div class="result-row odd"> <div class="domain-name">first-domain.com</div> <div class="domain-functions"> <a onclick="deleteDomain(1)" href="javascript:void(0);"> <img height="24" width="24" alt="48x_delete" src="images/48x_delete.png"> </a> <a onclick="editDomain(1)" href="javascript:void(0);"> ...

What does the jquery selector '$("#someID > * *")' mean?

What is the meaning of this selector: $("#someID > * *") I know that > means child nodes and * means all nodes, but I'm confused by the two asterisks. Any ideas? ...

Copy cell value from table to textbox

I have the following table. I want to copy Id value on the seleced row to the text box. If I click on link "Select" in the first row the text box value will 0001. If the table needs modification to get result better and faster, please leave your suggestion. <div> <input id="selectedId" type="text" /> </div> <table cellspa...

Split a string on a pattern

var a="##55##data1!!##66##data4545!!##77##data44!!"; how to remove ##664545##data!! from the string Edit:if we know the start value in a string i.e,##66## and the end value ie,!! In the main string how to remove characters starting from the start pattern,data after the start pattern till the end pattern My expected output w...

.keypress on a DIV tag ??

Is there a way to get work .keypress on a div element like this?: <html> <body> <script type="text/javascript"> <!-- $('#idtext').keypress(function(event) { var keyCode = event.keyCode; $('#idtext').text(function(i, text) { return text + String.fromCharCode(keyCode); }); }); // --> </script> <div id="idtext"></div> </b...

jQuery click() event catch-all?

we're showing a box on the screen that I want to hide when the user clicks anywhere on the screen, including body, anchors, divs, buttons, etc... Is there a selector that can handle this for me? Or is it a case of $('body, a, div, input').click()? ...

Small Programming confusion regarding if else and else if in jquery

Say i have a table row with the two text boxes and i want to manipulate them based on the screens and some array values <tr id ="myrow" style="display:none"> <td> test1<input type="text" name="some" value ="some"> test2<input type="text" name="test2" value ="test2"> </td> </tr> i a...

jQuery class within class selector

<div class="outer"> <div class="inner"></div> </div> how do I find the inner div here? $container.find('.outer .inner') is just going to look for a div with class="outer inner", is that correct? so I tried $container.find('.outer > .inner') but that doesn't seem to be working. Edit: I know its easy to find with something l...

IE6 and JQuery Selectors with Spaces

Hello all, The following doesn't seem to work in IE6. However, it works with IE7+ and firefox. I think I have had a similar issue before where IE6 doesn't like spaces in JQuery selectors. However, I don't know how to re-write this so IE6 will accept it. $('#other_stages :checkbox:not(#section_2_active, #co_t)').change(); I have also ...

Is it faster to refer to jQuery objects (mostly DOM objects) by the variable name only, or by $?

To put it simply: Is this: var x = $('#selector-id'); x.slideDown(); Faster than: var x = $('#selector-id'); $(x).slideDown(); ...

select hidden input in div, unable to find; however source shows input tag in div

this is what the page looks like <div id="DivID"> <input type="hidden" id="Hidden1" value="Value1" /> <input type="hidden" id="Hidden2" value="Value2" /> <bunch of other tags> </div> When I do $("#DivID").find("input#Hidden1").val() I'm getting undefined. However when I $(":input#Hidden1").val() I'm getting Value1 Invest...

jQuery selectors not what I expected

Using jQuery 1.4.2 (IE8 in compatibility mode) Given the following structure: <div id='something'>something</div> <div id='parental'> <div><p>hi there</p> goats</div> <p>hello again</p> </div> <div> end of the line</div> and this code: var Fred= $('#parental'); $('div').css({color: 'blue'}); Fred.children('div').css({color: ...