首页 \ 问答 \ 如何在调用css之前调用钩子,在JQUERY中使用html函数?(how to invoke hook before calling css , html functions using in JQUERY?)

如何在调用css之前调用钩子,在JQUERY中使用html函数?(how to invoke hook before calling css , html functions using in JQUERY?)

我满足了从用户那里获取js语句并应用于页面的要求

由于某种原因,我必须保持元素的跟踪状态

当用户给出类似的陈述时,我面临问题

$("someselector").css("color":"red");

要么

$("someselector").html("new text");

我将获得声明并在页面中应用,在这里我无法采取原始元素的备份

在jquery中有什么方法我可以在调用css,html函数之前调用一个钩子函数并进行元素备份


I meet the requirement where i get the js statements from the user and apply to the page

for some reason i have to keep track state of the element

i am facing problem when user gives the statments like

$("someselector").css("color":"red");

or

$("someselector").html("new text");

i will get the statements and apply in page, here i am not able to take the backup of original element

is there any way in jquery where i can call a hook function before calling css , html function and take the element backup


原文:https://stackoverflow.com/questions/42927802
更新时间:2023-10-03 10:10

最满意答案

在你的双向关系中, Tenant是关系的所有者。 由于您坚持Apartment您必须手动设置租户公寓 。 如果您想摆脱手动设置,请按照以下步骤更改@OneToMany

@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name="ApartmentID",referencedColumnName="ApartmentID")
private List<Tenant> tenants;

顺便说一下,如果你是租客公寓 ,你现在的样本; 公寓将自动持续。


In your bi-directional relationship Tenant is the owner of the relationship. Since you are persisting Apartment you have to manually set the apartment of tenant. If you want to get rid of manual setting change your @OneToMany as follows:

@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name="ApartmentID",referencedColumnName="ApartmentID")
private List<Tenant> tenants;

By the way, with your current sample if you are persisting tenant with apartment; apartment will be automatically persisted.

相关问答

更多
  • 你必须映射你的类。 public class User { ... @OneToOne (mappedBy="user") private UserPicture userPicture; ... } public class UserPicture { ... @OneToOne @JoinColumn (name="user") private User user; ... } You have to map your clas ...
  • 要在“详细信息”表中获取与非空外键列的双向关联,您可以在DetailsMap类中添加建议的Owner属性,参考(...)CanNotBeNull()映射,并将Summary结束反向。 为避免两个关联方向有两个不同的外键列,您可以手动指定列名称,也可以以两个方向给出相同列名称的方式命名属性。 在这种情况下,我建议将Details.Owner属性重命名为Details.Summary。 我通过增量生成了Summary id,以避免在插入表时出现问题,因为Summary currenty除了id之外没有列。 域: ...
  • 甚至可以在JSON中表示双向关系吗? 一些数据格式不适合某些类型的数据建模。 在处理遍历对象图时处理循环的一种方法是跟踪您到目前为止看到的对象(使用身份比较),以防止自己进入无限循环。 Can a bi-directional relationship even be represented in JSON? Some data formats are not good fits for some types of data modelling. One method for dealing with cy ...
  • 暂时我正在做一个session.update(父)。 这使CHILD表中存在的外键和孤立记录无效。 在我手动完成了孤儿的session.delete(...)之后。 这更像是一种解决方法,而不是解决方案。 For the time being I am doing an session.update(parent). Which nullify the foreign keys and orphan records exist in the CHILD table. And there after I do ...
  • 我正在使用JPA 2.1和Hibernate 5.0.1。 以下为我工作: 两个映射对象成员都使用以下注释: @OneToOne(optional = true) @JoinColumn(name = "common_identifier", referencedColumnName = "common_identifier", insertable = false, updatable = false) 让两个实体都实现Serializable。 我不确定为什么这部分是必要的,但它似乎是。 I am u ...
  • 我有一个类似的问题,我通过使用自定义序列化器/解串器来解决它 这是我如何进行的(请适应您自己的代码): ChildSerializer public class ChildSerializer extends StdSerializer { private static final long serialVersionUID = -265706839304575646L; public ChildSerializer(Class t) { sup ...
  • 尝试修改集而不是替换它。 即: quotation.getQuotationItem().clear(); quotation.getQuotationItem().addAll(newSet); 这是由于一些冬眠的怪异。 除此之外,还有一点关于命名。 您的Quotation.quotationItem应该命名为quotationItems因为它包含多个QuotationItem 。 Try to modify the set rather than replace it. i.e.: ...
  • 你没有使用正确的映射。 虽然每个员工可能只有1个部门,但每个部门可能有1个以上的员工。 因此,您在查询中看到的错误。 它只期望1名员工,但却获得了多名员工。 You're not using the right mapping. While it may be true that each employee has just 1 department, each department presumably has more than 1 employee. Thus the error you see on ...
  • 好吧,我自己想通了。 诀窍是显示错误消息: error_reporting(E_ALL); ini_set('display_errors', '1'); 我需要用值填充一些字段。 不允许为空。 DOH! Ok, I figured it out myself. The trick was to show error messages: error_reporting(E_ALL); ini_set('display_errors', '1'); I needed to fill some fields ...
  • 在你的双向关系中, Tenant是关系的所有者。 由于您坚持Apartment您必须手动设置租户的公寓 。 如果您想摆脱手动设置,请按照以下步骤更改@OneToMany : @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name="ApartmentID",referencedColumnName="ApartmentID") private List tenants; 顺便说一下,如果你是租客和公寓 ,你现在的样本; 公寓将自动持续。 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)