javascript - jEditable input-box CSS style - Stack Overflow

I am trying to style an input-box rendered using jEditable.I want to change the color of the table-cell

I am trying to style an input-box rendered using jEditable.

I want to change the color of the table-cell when the text is double-clicked and made editable. Like this:

alt text .png

This is where I am at the moment: jEditable CSS Problem (double-click the text in the table-cells)

HTML snippet:

<tr class="odd">
    <td class="dblclick" headers="customer-name">Drogo Shankara</td>
    <td class="dblclick" headers="mail">[email protected]</td>
    <td class="dblclick" headers="type">Web</td>
    <td class="dblclick" headers="status">Pending mail</td>
</tr>  

jQuery code:

$(function() {

$(".dblclick").editable("#", { 
    tooltip   : "Doubleclick to edit...",
    event     : "dblclick",
    css : 'inherit'
    });
});

Corresponding CSS:

.dblclick form {
    height: inherit !important;
    width: inherit !important;
    border: 0;  
    margin: 0;
    padding: 0;
    background: red;
    }

.dblclick input {
    height: inherit !important;
    width: inherit !important;
    border: 0;  
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    }

I want the input-box to inherit the height & width from the parent table-cell, but when I look at the input-box in Firebug it has an inline CSS height & width already set, causing the table-cell to scale when the td text is pressed. I try to override the inline CSS with inherit !important, but it doesn't work.

There is some concept in play here that I haven't fully understood, but it could be something totally banal.

Any ideas what is wrong?

I am trying to style an input-box rendered using jEditable.

I want to change the color of the table-cell when the text is double-clicked and made editable. Like this:

alt text http://www.hongaijitsu./temp/foobar/public/Picture-2.png

This is where I am at the moment: jEditable CSS Problem (double-click the text in the table-cells)

HTML snippet:

<tr class="odd">
    <td class="dblclick" headers="customer-name">Drogo Shankara</td>
    <td class="dblclick" headers="mail">[email protected]</td>
    <td class="dblclick" headers="type">Web</td>
    <td class="dblclick" headers="status">Pending mail</td>
</tr>  

jQuery code:

$(function() {

$(".dblclick").editable("#", { 
    tooltip   : "Doubleclick to edit...",
    event     : "dblclick",
    css : 'inherit'
    });
});

Corresponding CSS:

.dblclick form {
    height: inherit !important;
    width: inherit !important;
    border: 0;  
    margin: 0;
    padding: 0;
    background: red;
    }

.dblclick input {
    height: inherit !important;
    width: inherit !important;
    border: 0;  
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    }

I want the input-box to inherit the height & width from the parent table-cell, but when I look at the input-box in Firebug it has an inline CSS height & width already set, causing the table-cell to scale when the td text is pressed. I try to override the inline CSS with inherit !important, but it doesn't work.

There is some concept in play here that I haven't fully understood, but it could be something totally banal.

Any ideas what is wrong?

Share Improve this question edited Apr 14, 2012 at 20:48 Dave Jarvis 31.2k43 gold badges184 silver badges323 bronze badges asked Oct 1, 2008 at 17:40 timkltimkl 3,33912 gold badges59 silver badges71 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

jQuery/JavaScript is manipulating the DOM and dynamically adding/setting the widths of the input fields each time you doubleclick. Since inline styles (here dynamically generated in the DOM) take precedence over all other styles, you can not alter dynamically rendered inline styles with new attributes in the attached class. If you would like to get rid of the strange jumping effect, remove the attribute setting the width of the entire table in your screen.css file:

table { border-collapse: collapse; /width: 940px; ...remove/ }

It seems that the code gets confused when calculating the width to set the input field to when using a fixed table width (or maybe there is css somewhere there that is "clashing"). When I removed the width from the table, the functionality works and looks ok.

Hope this helps, let me know if it doesn't...

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745664266a4639027.html

相关推荐

  • javascript - jEditable input-box CSS style - Stack Overflow

    I am trying to style an input-box rendered using jEditable.I want to change the color of the table-cell

    21天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信